Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 20th, 2004, 11:02 AM
Authorized User
 
Join Date: Sep 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form Validation

thanks for all ur help . it worked after i created a hidden field on the form and compared it to that value of the textbox.

Another problem in the form validation:


when i validate the form , and one of the values is incorrect it pops up with a message to correct
that field but the problem is it resets the other correct fields on the form. how do i correct that.


 
Old September 20th, 2004, 01:10 PM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sureshbabu Send a message via Yahoo to sureshbabu
Default

I think you are submitting the same page after validating the form. My suggestion is dont submit it.
Other wise use hidden fields for each control and store the value of the controls in it, and get the vaues from hidden fields after submitting it.
Thanks
Suresh babu

 
Old September 20th, 2004, 09:27 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

Yes,

  Could be the problem is "form submitted"

When the alert is displayed, issue the statement
return false;

It prevents from submitting the form


<form name="frm1" action="..." method="post">
<input type="text" name="txt1">
<input type="button" value="Submit" onclick="sbm()">
</form>

<script language="javascript">
function sbm(){
  if(frm1.txt1.value==""){
  alert("Enter ...");
  frm1.txt1.focus();
  frm1.txt1.select();
return false;
}

//if all validations are over
frm1.submit();
}
</script>


----------
Rajani

 
Old October 1st, 2004, 03:09 AM
Friend of Wrox
 
Join Date: May 2003
Posts: 229
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you are using any tool such as macromedia dreamweaver to design your HTML pages, they provide you to write form validation scripts without writing a single line of code by using their wizards



Charul Shukla
 
Old October 1st, 2004, 08:11 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 104
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to sureshbabu Send a message via Yahoo to sureshbabu
Default

Hi,
     Next time onwards get the all the control values from hidden fields like....

value=<%=request.form("hiddenFiledName").


Then you can see all the values there..

Thanks
suresh






Similar Threads
Thread Thread Starter Forum Replies Last Post
Standalone validation + web form validation morbo Struts 0 August 19th, 2008 04:02 AM
form validation EmWebs Dreamweaver (all versions) 6 January 23rd, 2007 10:01 AM
Form Validation Stanny Access VBA 5 December 20th, 2005 08:13 PM
Validation of Form qazi_nomi Javascript 5 August 2nd, 2004 03:49 PM
Form not refreshing after form validation Mimi Javascript How-To 0 August 25th, 2003 03:20 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.