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 8044893
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:22:34+00:00 2026-06-05T05:22:34+00:00

i working on a website and i have to check some form such that

  • 0

i working on a website and i have to check some form such that any field should not be empty, if there is any empty field it should write this field is empty on the right side of field name

my form code is:-

        <form action="Owners Infoback.php"  onsubmit="return validateForm()"  method="post" name="enquiry" id="" class="form-body-02">
    <ul>
        <li>1. Name of owner <input name="Name_of_owner" type="text" class="textarea-bk-02" id=""  value="" style="border:none; width:330px; margin-left:40px; margin-top:15px; height:20px;"/>

        </li>
        <li>
         2. Name of company:<br />
         <p>(Enter name registered)</p></label>
        <input name="Name_of_company_registered" type="text" class="textarea-bk-02" id=""  value="" style="border:none; width:330px; margin-left:40px; margin-top:13px; height:20px;"/>
        </li>
        <li>
          3. Address:<p>(Write your own manufacturer address)</p>

        <input name="Owner_address" type="text" class="textarea-bk-02" id=""  value="" style="border:none; width:330px; height:20px; margin-left:40px; margin-top:13px;"/></li>

        </li>
        <li>
          4. Email id:
          <input name="Owner_Email_id" type="text" class="textarea-bk-02" id=""  value="<?php echo "{$row[3]}";?>" style="border:none; width:330px; margin-left:40px; margin-top:13px; height:20px;"/>
        </li>
        <li><input name="Save" type="submit"  class="send-btns-02 right" value="save" style="margin-top:5px;" >
        <div class="clear"></div>
        </li>
    </ul>

and my java script function is:-

   function validateForm(string msz)
  {
 var x=document.forms["enquiry"]["Name_of_owner"].value;
if (x==null || x=="")
{
msz="First name must be filled out");
return msz;
}
x=document.forms["enquiry"]["Name_of_company_registered"].value;
if (x==null || x=="")
{ 
alert("Name of company registered filled out");
return false;
}
x=document.forms["enquiry"]["Owner_address"].value;
if (x==null || x=="")
{
alert("Owner addressmust be filled out");
return false;
}
 x=document.forms["enquiry"]["Owner_Email_id"].value;
 var atpos=x.indexOf("@");
var dotpos=x.lastIndexOf(".");
if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
{
 alert("Not a valid e-mail address");
 return false;
}
}

and i want instead of alert function it should return a star(*) and message please fill this form just right of field name, please help me..thanks in advance..

  • 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-05T05:22:36+00:00Added an answer on June 5, 2026 at 5:22 am

    You could put hidden Divs next to each form input:

    <div id="nameOfOwnerError" style="display:none">*</div>
    

    And do this for each input, then you can choose to show/hide them depending whether they are valid or not:

    $("#nameOfOwnerError").show();
    

    Edit: Neeraj – try this.

    In Javascript (sorry), something along the lines of…..

     var nameOfOwnerError = document.getElementById("nameOfOwnerError");
    nameOfOwnerError.style.display="visible";
    

    Off the top of my head, but you get the idea. Main point was simply to hide the asterisks and show hide them using the code you have.

    Edit2: Sorry Neeraj, was untested – this works for me:

    document.getElementById('nameOfOwnerError').style.display = "";
    

    makes the element reappear and you could do

    ...display="none"; 
    

    in the js code to hide again

    Edit3: You could add an OnKeyUp event to the textboxes, so that when a text is entered into the textbox, you could trigger you validation script:

    <input name="Name_of_owner" type="text" onkeyup="validateForm('');" class="textarea-bk-02" id=""  value="" style="border:none; width:330px; margin-left:40px; margin-top:15px; height:20px;"/>
    

    Using the ifs to determine if the field is empty (as you are doing), you should be able to show/hide the asterisks as soon as a user has typed into a given textbox.

    Got to go for now but something along these lines is what you’re looking for, good luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a website that has some images that I need
I am currently working on a website that will have a high volume of
I have a website that per original developer was working on local environment. I
So I already have the website working (I'm not working from scratch). The problem
Problem: I'm working on a website where there is a dial that displays a
I have a working version of a website that is a clone of the
I have working website in PHP with a MySQL backend which has several tables
I have a working website, where I use this expression everywhere. price.ToString(C) It currently
I'm working on a website and have been using absolute positioning, since the viewport
I am working on a website where I have a main div . I

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.