Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet PROBLEM IN FORM VALIDTION
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Anie Mukherjee
PROBLEM IN FORM VALIDTION
0 Answer(s)      a year and 6 months ago
Posted in : JSP-Servlet


i applied validation IN THIS JSP PAGE.if i leave username/password empty,i will be promped to enter those to feilds.but the PROBLEM is that after i press OK on validation prompt,the page goes to 2_control.jsp.I WANT IT TO GO TO NXT PAGE ONLY IF the validation thing is ok,not otherwise.plz hlp.

Hi. Here is my code:

<html>
<head>
<script>
function validLogin(){
if (document.form.userName.value == ""){
alert ( "Please enter Login Name." );
document.loginform.userName.focus();
return false;
}
if (document.form.password.value == ""){
alert ( "Please enter password." );
document.userform.password.focus();
return false;
}
alert ( "Welcome User" );
return true;
}
</script>
</head>
<body>
<form name="form" method="post" action="2_control.jsp" onsubmit="return validLogin();">
<table width="250px" border=0 style="background-color:ffeeff;">
<tr><td colspan=2 align="center" style="font-weight:bold;font-size:20pt;" align="center">User Login</td>
</tr>
<tr><td colspan=2> </td>
</tr>
<tr><td style="font-size:12pt;" align="center">Login Name:</td>
<td><input type="text" name="userName" value=""></td>
</tr>
<tr><td style="font-size:12pt;" align="center">Password:</td>
<td><input type="password" name="password" value=""></td>
</tr>
<tr>
<td></td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</form>
</body>
</html>

Thanks.


Advertisement
View Answers

Related Tutorials/Questions & Answers:
PROBLEM IN FORM VALIDTION
PROBLEM IN FORM VALIDTION  i applied validation IN THIS JSP PAGE.if i... the PROBLEM is that after i press OK on validation prompt,the page goes...; } </script> </head> <body> <form name="form" method="post
PHP Sticky form problem
PHP Sticky form problem  I have done the full coding of a sticky form.... Please see my coding below...and advice me what is the problem, and what...;/head> <body> <h1>Simple Calculator</h1> <form action
Advertisements
PHP Sticky form problem
PHP Sticky form problem  I have done the full coding of a sticky form.... Please see my coding below...and advice me what is the problem, and what...> <form action="simple_calculator.php" method="post"> <p>Number 1
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
Problem in enctype="multipart/form-data" in JSP
Problem in enctype="multipart/form-data" in JSP  im using a page... the file itself when i click the submit button. im using enctype="multipart/form-data" in this form. i also using the commons-fileupload-1.2.2.jar file for getting
Problem when resizing the form - Swing AWT
Problem when resizing the form  Hi, I am facing a problem when resizing the form. I have a JTextPane on the JInternalFrame which occupy all the form space at initial stage. we have a button to add a new JTextPane on the form
New Problem in Form Resizing - Swing AWT
New Problem in Form Resizing  Hi, I am using a MDI application...)); The problem is arising when the user resizes the form. The EditorPane(old... the form? This problem is occuring only the components which are added
Problem submitting a struts form containing a dojo script - Struts
Problem submitting a struts form containing a dojo script  Hello there, Is there any way to make use of dojo with struts 1 ? Actually, I'm facing a problem submitting a struts form containing a dojo script for a dynamic
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"> <
form
form   Can I prevent a form from being submitted again
jsp form
jsp form  hi sir, one got one got in jsp form after entering the data into the form the data is not saving in the database i will send you code of two forms if dnt understand my problem
PHP form
PHP form  Hi Sir/Madam, I am developing an attendance form using php... am adding one textfield to enter the Attendance... The problem is I am... form and update them to respective coloumn... Please any one help mo out please
form validation
form validation  how the form validation is done in jsf form using javaScript
print a form of *
print a form of *   * *** ***** ******* ********* ******* ***** *** *   Post the format properly
Multipage form
Multipage form  I have a multipage form in php with 2 pages wnhen i submit the form data from both the pages should go in database how should i pass teh data from 1st page to 2nd page and then put the entire form data in mysql
dynamic form
dynamic form  I need to make a dynamic form using php, for example, i... button wich once clicked we have a new list created on the same form. Thank you...("There was a problem while using XMLHTTP:\n" + req.statusText
Ajax form element - Ajax
Ajax form element  I have problem in passing a value into form feild using ajax. I want to get the value is as a parameter. Can some one help me plz
submit a form
submit a form  How can we submit a form without a submit button
Form handling
Form handling  I created a spring project. I created a jsp...;form:form name="loginForm" modelAttribute="loginForm" method="get"> <...;/td> <td> <form:input path="username"/>
Form Validation
Form Validation  Java script validation for checking special characters and white spaces and give an alert.Please help me urgent Thanks in advance
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
<form id=
form id  sir, <form id="reg1" action="../UploadingCtrl" method="post" enctype="multipart/form-data" name="form1"> this action page can't get String tp = request.getParameter("indegrates"). i wrote article upload
Form validation
Form validation  Hi Everyone Can someone assist me with a complete code to validate a form. e.g where the user must insert an ID number it should check if the user entered the correct data and within a valid range. This must
Employee form
Employee form  In employee form emp Id id after any data iserted is incremented for oher data insertion. insert, delete, update buttons when we cleak the select buttoun then the created table data iserted automaticaly
other form
other form  Can I write this code in other form: if (quantity>=5) { System.out.println("Congrats!! You get a discount of 5%."); } else { System.out.println("you can avail a discount of 5% when you make a purchase of 5 items
struts form
struts form  Hi, This is Rajesh.I'm creating struts form in jsp.i have two textboxes in my jsp.During Jsp page loading focus will automatically should come to second textbox(That means during page loading cursor automatically
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components prepsent in that form are getting clearedup using frameobject.setVisible(false
login form
login form  sir my next form consists logout button when i click on it it showing login form but next form window is not closing but the components prepsent in that form are getting clearedup using frameobject.setVisible(false
Login Form
of +,on clicking which a login form appears. Only the middle column is different
Login Form
of +,on clicking which a login form appears. Only the middle column is different
Advertisements
 

 

 

DMCA.com