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 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 Tutorials/Questions & Answers:
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
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
Advertisements
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 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
Displaying Error pages in results tree in jmeter
Displaying Error pages in results tree in jmeter   Displaying Error pages in results tree in jmeter
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 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
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
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  
validating credentials and displaying error message in login .jsp if not valid
validating credentials and displaying error message in login .jsp if not valid  hi, i want to validate user name and password against my database table if not valid i have to display error message in my login page.how to do
ModuleNotFoundError: No module named 'django-form-error-reporting'
ModuleNotFoundError: No module named 'django-form-error-reporting'  ...: No module named 'django-form-error-reporting' How to remove the ModuleNotFoundError: No module named 'django-form-error-reporting' error? Thanks
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
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
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> <
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
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 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... it contains same checkboxes.ADS_TO_REPLACE_2 So, from your above code, i can display selected checkbox on same page. It works... But when i go to another
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
this code will be problem it display the error again send jsp for registration form
this code will be problem it display the error again send jsp for registration form  I AM ENTERING THE DETAILS OFTER IT DISPLAY THE ERROR PLEASE.... 1)register.jsp <html> <form method="post" action="insert.jsp"> <
this code will be problem it display the error again send jsp for registration form
this code will be problem it display the error again send jsp for registration form  I AM ENTERING THE DETAILS OFTER IT DISPLAY THE ERROR PLEASE.... 1)register.jsp <html> <form method="post" action="insert.jsp"> <
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
form
form   Can I prevent a form from being submitted again
displaying data
displaying data   how to display data from database on jsp using struts2
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
Image is not displaying
Image is not displaying  Hii i am using spring javamail with html template to send mail,i am facing that image displaying prob when mail have to cm in gmail,in template just i am giving my current location of image which
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
error
error  while iam compiling iam getting expected error
Error-
Error-   Hello, I would like to know about XSD file. I try to print XML file but I am getting error SAXException-- says Content is not allowed in prolog. Please help me
error
error  i have 404 error in my program plz tell me yhe solution about
error
error  i have 404 error in my program plz tell me yhe solution about
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
error
/ServletUserEnquiryForm.shtml getting an error given below SQLException caught: [Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error please suggest
Error
Error  I have created ajax with php for state and city. When I change state then city will not come in dropdown list and it give me error as 'Unknown Runtime Error'. This error come only in IE browser, but in other brower
error
error  java.lang.unsupportedclassversionerror:bad major version at offset 6 how to solve this????   Hi, Please check the version of framework used and also the JDK version.ADS_TO_REPLACE_1 This type error also comes
error
error
error
error  When I deploye the example I have this message cannot Deploy HelloWorld Deployment Error for module: HelloWorld: Error occurred during deployment: Exception while deploying the app [HelloWorld
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
error!!!!!!!!!
error!!!!!!!!!   st=con.createStatement(); int a=Integer.parseInt(txttrno.getText()); String b=txttname.getText(); String c=txtfrom.getText(); String d=txtto.getText
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern
Error
Error  Hi. I am getting error in the following code after the line I have commented as ERROR. How to solve this. Thanks in advance. package...;"); // ERROR out.println(" var pattern = /^\d{3,5
error
"+it); } } this is my program i am getting an error saying cannot find symbol class stringADS
error
error  whats the error.............. import java.util.Scanner; public class g { public static void main(String[] args) { Scanner s=new Scanner(System.in); int d,x,y; System.out.println("Enter the first number
codes for displaying in calendar
codes for displaying in calendar  can i get jsp codes for displaying comments, when the pointer is placed over the particular date in calendar
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
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 >> <

Ads