•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JSP section within the Web Development category of DaniWeb, a massive community of 392,091 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,933 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JSP advertiser: Lunarpages JSP Web Hosting
Views: 621 | Replies: 3 | Solved
![]() |
•
•
Join Date: Jun 2007
Posts: 15
Reputation:
Rep Power: 2
Solved Threads: 0
Hi,
I have a jsp page where the user is asked to do certain entries. Now if the user leaves any one of the entires as blank or as a wrong entry and presses the submit button, he gets an alert message.
Now after the user presses okay,, the page entries becomes either blank or null and then the user has to enter everything again.
Can any one help me.
Thanks a ton in advance
Saswati
I have a jsp page where the user is asked to do certain entries. Now if the user leaves any one of the entires as blank or as a wrong entry and presses the submit button, he gets an alert message.
Now after the user presses okay,, the page entries becomes either blank or null and then the user has to enter everything again.
Can any one help me.
Thanks a ton in advance
Saswati
•
•
Join Date: Nov 2004
Location: Netherlands
Posts: 5,646
Reputation:
Rep Power: 18
Solved Threads: 191
If you are by any chance attaching or calling the validation function to the 'onclick()' event of the 'submit' button, you need to return a value from the validation function to prevent the trip to the server and to make the data in the form fields persist.
Of course I would like to point out here that client side validation sucks and are of no value whatsoever. Real validations are done at the server. The javascript executing on the client is entirely at the mercy of the person sitting in front of the computer on which it is executing, and so client-side code provides precisely zero security.
<html>
<head>
<script type="text/javascript">
var SOS = {};
SOS.validate = function(myForm)
{
var returnCode = true;
if(myForm.elements['txt'].value.length == 0)
{
alert('YOu need to enter something');
returnCode = false;
}
return(returnCode);
}
</script>
</head>
<body>
<form action="./Servlet?QueryString">
<input type="text" id="txt" name="txt" />
<br />
<input type="submit" onclick="return SOS.validate(this.form);" />
</form>
</body>
</html>Of course I would like to point out here that client side validation sucks and are of no value whatsoever. Real validations are done at the server. The javascript executing on the client is entirely at the mercy of the person sitting in front of the computer on which it is executing, and so client-side code provides precisely zero security.
Last edited by ~s.o.s~ : Aug 10th, 2007 at 2:24 am.
"I don't accept change. I don't deserve to live."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JSP Marketplace
Similar Threads
- Browser hijacked by About:Blank (Viruses, Spyware and other Nasties)
- about:blank Please review my HijackThis log (Viruses, Spyware and other Nasties)
- about:blank hijack (Viruses, Spyware and other Nasties)
- Needing help with About:Blank XP SP1 (Viruses, Spyware and other Nasties)
Other Threads in the JSP Forum
- Previous Thread: Please help me out running servlet
- Next Thread: catch without try error



Linear Mode