Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Validation script cant seem to work

 
vanan saravanan
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to validate some fields in my form but cant get it to work. I think its because of the submit button code. Could someone please help identify the problem.

<script language="JavaScript"<
function validate_form ( )
{
if ( document.leaveform.dc1.value == "" )
{
alert ( "Please select start date" );
valid = false;
return valid;

}
}


<input name="b1" type="button" value="Submit Without Preview"
<ON CLICK ="this.form.action< ='fastsaveregistrationdetails.jsp';this.form.submit()"<
 
Natasza Biecek
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I hope this may help:
http://www.elated.com/tutorials/programming/javascript/form_validation/

hmm..to diagnose what's wrong it would be nice to see
HTML code of your form (the best rounded by [ CODE ][ /CODE ] tags )

Natasza
 
vanan saravanan
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is i cant change the following code as i'm using it for having multiple submit buttons on one form. Please advice on how i can run the validation script based on this. Thank you..

input name="b1" type="button" value="Submit Without Preview"
<ON CLICK ="this.form.action< <='fastsaveregistrationdetails.jsp';this.form.submit()"<
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And where are you calling this validation code? I do not see it.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic