aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Validation script cant seem to work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Validation script cant seem to work" Watch "Validation script cant seem to work" New topic
Author

Validation script cant seem to work

vanan saravanan
Ranch Hand

Joined: Jun 02, 2006
Posts: 95
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

Joined: Oct 26, 2006
Posts: 28
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

Joined: Jun 02, 2006
Posts: 95
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

Joined: Nov 08, 2001
Posts: 15376
    
    6
And where are you calling this validation code? I do not see it.

Eric
 
 
subject: Validation script cant seem to work