E-Junkie Forum http://www.e-junkie.com/bb/ E-Junkie Forum RSS en-us Copyright 2012, 19.5 Degrees. All rights reserved. webmaster@e-junkie.com webmaster@e-junkie.com Wed, 7 Apr 2010 13:13:43 GMT Sat, 26 May 2012 01:55:40 GMT 681 E-JUNKIE 5 E-Junkie Forum http://www.e-junkie.com/bb/ http://www.e-junkie.com/ej/logo.gif 290 104 Post #4 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 Wed, 7 Apr 2010 13:13:43 GMT
In the end though, since I needed 3 validations and not just the one for the agreement, I did have to combine them all, into what you see above.]]>
E-junkie Discussions; medusa
Post #3 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 Tue, 6 Apr 2010 20:53:13 GMT E-junkie Discussions; E-junkieGuru Post #2 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 Tue, 6 Apr 2010 19:19:19 GMT
function validate_form ( )
{
valid = true;

if ( document.form_name.os0.value == "" )
{
alert ( "Please fill in the Name." );
valid = false;
}

if ( document.form_name.os1.value == "" )
{
alert ( "Please fill in the Address." );
valid = false;
}

if ( document.form_name.id_agree.checked==false )
{
alert ( "You must agree to our terms and conditions before proceeding with purchase." );
valid = false;
}

return valid;


}

and then just calling that on the onClick. You have to name the form, and id the checkbox and use those same names in the function in the appropriate spots.]]>
E-junkie Discussions; medusa
Post #1 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 http://www.e-junkie.com/bb/topic/4279/pg/0#post13982 Tue, 6 Apr 2010 17:47:15 GMT
So there are two functions that the onClick event needs to call. How do I combine functions into the onClick event?

I currently have onClick="return agreed(this);" and want to add onClick="return validate_form ( );" so that it performs both functions. I've tried onClick="return agreed(this);return validate_form ( );" to no luck. Is there a way to combine the onClick functions?

I am using javascript code from http://www.elated.com/articles/form-validation-with-javascript/ to validate the form, and code from http://juxtaprose.com/articles/e-junkie-click-agree.html to validate the agreement checkbox. Both would seem to be called through the onClick event.

Or is there another way to require form variants that I do not know of? Thanks for the help, it is much appreciated!]]>
E-junkie Discussions; medusa