Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8013773
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T19:43:23+00:00 2026-06-04T19:43:23+00:00

I have created an HTML form in which there are a number of different

  • 0

I have created an HTML form in which there are a number of different text boxes. What I want to do is to create a javascript script that will display little images next to the boxes that have no text in them. Here is an example of what I want to do:

enter image description here

At the moment I have created the following script which validates the form as I’d like, however it only displays a popup box since I don’t know how to display images/text. Here is the code I have:

    <script type="text/javascript">
    function validateForm()
    {
        var x=document.forms["email_form"]["name"].value;
        if (x==null || x=="")
        {
            alert("Please enter your name in the box provided.");
            return false;
        }

        var x=document.forms["email_form"]["email"].value;
        if (x==null || x=="")
        {
            alert("Please enter your e-mail address in the box provided.");
            return false;
        }

        var x=document.forms["message-title"]["name"].value;
        if (x==null || x=="")
        {
            alert("Please enter a message title in the box provided.");
            return false;
        }

        var x=document.forms["email_form"]["message"].value;
        if (x==null || x=="")
        {
            alert("Please enter your message in the box provided.");
            return false;
        }
    }
    </script>

Please can someone point me in the right direction?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T19:43:24+00:00Added an answer on June 4, 2026 at 7:43 pm

    You can have the error image elements next to the input elements but have the display property to hidden in css. you can have an id for each error image linked to their input element. for e.g. for email input, have and img element besides it. Have an initial css like this ->

    #email_form img{
        display: none;
    }
    

    and then in your javascript, simply display the hidden image –

        var x=document.forms["email_form"]["email"].value;
        if (x==null || x=="")
        {
            var error_image = document.getElementById('error_email');
            error_image.style.display = 'inline';
            alert("Please enter your e-mail address in the box provided.");
            return false;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form in an MVC view which contains a number of text
I have created an HTML Autorun which run from a CD, there is a
I have an html table which is dynamically created. The number of rows and
When you have an ASP.Net MVC form created by Html.BeginForm(), how do fields inside
i have create a form (so it's PHP and HTML hybrid-code). it has ability
I have created a html page in php and upon submission i validates that
I have created a basic shape in HTML canvas element which works fine. The
the procedure: i have a script which uploads images (via hmtl-form and php) for
I have created a application which checks if the text in clipboard starts with
I have an existing HTML form that I'm trying to update to use jQuery.load().

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.