Home Answers Viewqa JavaScriptQuestions Displaying error on the Same form

 
 


harit
Displaying error on the Same form
1 Answer(s)      a year and 8 months ago
Posted in : JavaScript Questions

I want to display the errors on the same form(Top of the form) after validation. I am used Div element and Table to display the error messages. It is working properly. But those error messages overlapping the existing contents which developed by the designer. There is a root Div element they are using for Window purpose. I tried to resize it using DOM. But the problem is still. Could you please provide me the reason or possible solutions for the issue?

View Answers

September 22, 2011 at 1:00 PM


<html>
<script>
function validate(){
var n=document.getElementById("name").value;
var a=document.getElementById("address").value;
if(n==""){
document.getElementById("lab").style.visibility="visible";
document.getElementById("lab").innerHTML="<font color=red>Enter Name!</font>";
return false;
 }
 if(a==""){
document.getElementById("lab").style.visibility="visible";
document.getElementById("lab").innerHTML="<font color=red>Enter Address</font>" ;
return false;
 }
       return true;
}
</script>
<form method="post" onsubmit="return validate();" action="">
<label id="lab" style="visibility:hidden;"></label>
<pre>
Enter Name:     <input type="text" id="name"><br>
Enter Address:  <input type="text" id="address"><br>

<input type="submit" value="Submit">
</pre>
</form>
</html>









Related Pages:
Displaying error on the Same form
Displaying error on the Same form  I want to display the errors on the same form(Top of the form) after validation. I am used Div element and Table to display the error messages. It is working properly. But those error messages
displaying image
displaying image  how to upload image and retrieve it form database...)form.html: <form method="post" enctype="multipart/form-data" action="upload.php...', '$fileType', '$content')"; mysql_query($query) or die('Error, query failed'); include
Displaying the values in text fields of a form from a javascript function in jsp
Displaying the values in text fields of a form from a javascript function... to display these values in 3 text fields of a form in the current web page. Here form and javascript function must be available in the same web page. Any help
displaying in ajax - Ajax
displaying in ajax  hi.. I have an Ajax page ,request gone to server ana details are bought... the response should be displayed in the same request...); xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded
Displaying Date in jsp - JDBC
Displaying Date in jsp  I want to insert Date of birth of a person...(result.getDay(),result.getMonth(),result.getYear())); i got an error which...;Hi form Insert into database function validateForm(theForm
displaying data based on criteria from 2 tables having same type of data - Java Beginners
displaying data based on criteria from 2 tables having same type of data  Dear Experts, First, thanks for replying my question regarding my... to process search criteria without having a form. I have recently read up about
Displaying search results in same panel of gridview in same jframe window.
Displaying search results in same panel of gridview in same jframe window.  Hello Sir, I have a search frame window from which we can search and see the results in the same panel of the Jframe in Gridview Jtable
Displaying search results in same panel of gridview in same jframe window.
Displaying search results in same panel of gridview in same jframe window.  Hello Sir, I have a search frame window from which we can search and see the results in the same panel of the Jframe in Gridview Jtable
Two or more actions in the same form
Two or more actions in the same form  Can I have two or more actions in the same form
more Submit buttons in the same form
more Submit buttons in the same form  Can I have two or more Submit buttons in the same form
Displaying Error pages in results tree in jmeter
Displaying Error pages in results tree in jmeter   Displaying Error pages in results tree in jmeter
redirecting a login authenticated form to a form to be displayed on the same page from where the login authentication has taken place.
redirecting a login authenticated form to a form to be displayed on the same...;/script> <form name="form" method="post" action="http://localhost... will get redirected again with error message. 1)login.jsp: <html> <
displaying data for a single column from Mysql database in the list box in php form
displaying data for a single column from Mysql database in the list box in php form  I have a form in php.want to display data from a single column... "</p>n"; ?>   YOUR CODE CONTAIN ERROR.. <?php</p>
displaying data from ms excel in form.
displaying data from ms excel in form.  Hi all, I have a requirement... (for example). I need to display these data in a form. along with the actual picture... them in the form. A code snippet will be more helpful. Thanks in advance
displaying - Ajax
displaying  hi.. im sending request from ajax page to servlet ..as in response i need the get the from database to servlet and from servlet to ajax in column wise.. i have to display the response column wise in the same
PHP Displaying URL Content
PHP Displaying URL Content  In my PHP application form, on submitting the form details it always displaying url content. Can anyone tell me what is the reason and how to restrict it from displaying
Get form value in same page - JSP-Servlet
Get form value in same page  Hello friends, Can we get a form field value in the same to be processed in java coding...-registration-form-using-jsp.shtml Thanks
Displaying the same image in a JPanel and using scroll - HELP - Java Beginners
Displaying the same image in a JPanel and using scroll - HELP  I hope someone can help me out here. I want to display an image in a JPanel which contain a Scroll, so using the scroll I want to see the first image displayed
dynamic form
button wich once clicked we have a new list created on the same form. Thank you...dynamic form  I need to make a dynamic form using php, for example, i...); } } </script> <form method="post" action="" name="form1"> <
form registration on JavaScript
form registration on JavaScript   i want form of registration on JavaScript > < check the name is string or number & if the name number output error >> and the same of email and birthday and country >> <
Retrieve all the students in the same year(Java ArrayList)?
Retrieve all the students in the same year(Java ArrayList)?  FoundStudents.jsp year- parameter I receive from a form search- is an object of type... the form .............................................. String year
Displaying Database information on the browser.
PHP DATABASE Information Part-5(b): Displaying Data (with the help... by using form on a website. First of all we will create a contact form in HTML. Let's see the following steps to displaying the data on the website : 1. First
Displaying files on selection of date.
Displaying files on selection of date.  Hi, I am developing a GUI, where i select from and to date. On selection of from and to date the GUI should... for same.   Here is a java swing code that accepts two dates and search
Displaying Rows - JSP-Servlet
Displaying Rows  Hi, I need your support on how to display data from ms sql 2000 database into an html form text box and text area, using java servlet or jsp  Hi friend, This is form code, display data
error in hatml form - Java Beginners
error in hatml form  Hi, I have two submit buttons(button1,button2) in login form. I want to specify default button action on button1 when i click enter key. Please help me.thank u in advance. regards, sakthi  
Displaying Database using PHP
PHP DATABASE Part-5(d) : Displaying Data (with the help of PHP Scripts) Till... will show you how to insert the information by using form on a website with the help of PHP Script. Let's see the following steps to displaying the data
displaying List of records from database in a jsp using ajax
displaying List of records from database in a jsp using ajax  Sir, I...', 'application/x-www-form-urlencoded'); //document.writeln("pr1... { alert("Error loading page\n"+xmlHttp.status+":"+xmlHttp.statusText
Displaying database values in pdf format
Displaying database values in pdf format  Hi All, I am developing a struts application.I am having one registration form when i am submitting the form the values are stored in database,the database name is registration
user Registration form using bean
user Registration form using bean   In this code,password and confirm password does n't matches.Every time an error occured if i entered same string for both.Please help to sort my problem
Form Processing Problem
Form Processing Problem  I am trying to create a Circular Page... to Null and //as well as the passed data from mulitpart/form-data is greater...; (contentType.indexOf("multipart/form-data") >= 0)) { DataInputStream
Servlets errors in same page.
Servlets errors in same page.  How do I display errors list in the same page where a form field exists using servlets...........i.e. without using JSP? Please explain with a simple username password program
Form with a search filter in spring mvc?
Form with a search filter in spring mvc?  Hi I am new to Spring MVC, I have created a spring project which is displaying the list from database into my jsp page, Now in the same jsp page at the right hand corner I have a search
Form with a search filter in spring mvc?
Form with a search filter in spring mvc?  Hi I am new to Spring MVC, I have created a spring project which is displaying the list from database into my jsp page, Now in the same jsp page at the right hand corner I have a search
using ajax and jsp (struts) to login and remain on same page.
using ajax and jsp (struts) to login and remain on same page.  I am... want to remain on same login page and just want to display loggers name ... I don't know how to use struts to remain on same page. What about config file:- <
i want to retriev and update in same form but its not working pls help....
i want to retriev and update in same form but its not working pls help....  <p><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN... id="contentarea"> <form name="viewpart" action="viewparticularappli.jsp
JSP - Problem of displaying result at webpage
JSP - Problem of displaying result at webpage  Can anyone please help to solve my problem below. My webpage has problem in displaying result position...; <form method="post"> <table border="1" width="100
getting error in your login form code
getting error in your login form code  i tried your code for login form but i am getting an error.the error is undefined index userid...   hi friend, your form's input must have following : <input type
Developing Forgot Password Form
Developing Forgot Password Form   ... Form code for our application. Developing Forgot Password Form   The forgot password form will be used, when user forgot their password. This form
displaying image in awt - Java Beginners
displaying image in awt  Hi All, I have downloaded the code to display image using awt from here and when I execute the code I am getting error like: D:\netbeans\myjavaappl\src\ImageDemo.java:21: incompatible types
Displaying checked checkbox in same page as well as print on another page ....also add next pages cheches checkbox into previous list
Displaying checked checkbox in same page as well as print on another page... same checkboxes. So, from your above code, i can display selected checkbox on same page. It works... But when i go to another page link containing same format
Displaying html code in pdf with itext - Java Beginners
Displaying html code in pdf with itext   Hi , I am geeting data which was enterd from fck editor. same data is stored... and background colour are not getting appied . is there any way to display the same
Displaying different portions of a page subsequently on the basis of action
Displaying different portions of a page subsequently on the basis of action  Suppose in Report.jsp there are two text fields From Date: and To Date... with previous portion on the same page that contains four Radio buttons(Group
Displaying database table on the windows screen in real time.
Displaying database table on the windows screen in real time.  ... need to write a program to display this table in a windows form or on a html page... on that form or page .There could be any approach to this.Prefer java. Please help
PHP Form Part-2
to send the script to the same page that the form is on. In other words...=""> So, here we are going to send the form data on the same page...Topic : HTML FORM Action Attribute Part - 2 If you noticed, in the previous
PHP form
PHP form  Hi Sir/Madam, I am developing an attendance form using php... not getting How to read these Multiple textfield with the same name values in another form and update them to respective coloumn... Please any one help mo out please
Tomahawk message tag
; If the user doesn't fill the fields in the form then error... in displaying the message related with a particular component. The component for which the error message is to be displayed is decided
SQL QUERY ERROR
THE FORM IS THROWING THE ERROR OF INVALID CHARACTER BUT THE SAME QUERY IS RUNNING...SQL QUERY ERROR  Im writing a query which shows error of INVALID CHARACTER The Query is Insert into PMST_EMP_MST(PMSNUM_EMP_ID,PMSSTR_EMP
Login Form
of News and Events. These two are same for every page.There's also an image of +,on clicking which a login form appears. Only the middle column is different
Login Form
of News and Events. These two are same for every page.There's also an image of +,on clicking which a login form appears. Only the middle column is different
form submission
form submission  I have two pairs of textboxes...( so in total 4...("Enter text4 value!"); return false; } return true; } </script> <form name="form" method="post" onsubmit="return validate();"> <input type="text

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.