Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Javascript form submit not onclicking.

Status
Not open for further replies.

boyfromoz

Technical User
Feb 1, 2001
469
AU
I am trying to submit a form using form button fever(see link)


Basically its a javascript behaviour that allows a rollover iamge to be used as a submit button. The only problem is, as it runs "onlcick" I can't run a form validation.

Can anyone think of a workaround where two onclick functions are needed to submit a form? one to run the javascript to submit using the rollover, the otehr to validate the form?

Richard
 
sure!

<img src=&quot;...&quot; onclick=&quot;if (validateForm()) {this.form.submit()}&quot;>

now, you must have your validateForm() function return a true/false value

function validateForm(){
if (document.forms[0].username!=''&&document.forms[0].password!='') return true
else return false}

(thats just something I whipped up real quick for form validation)

this should work theEclipse
eclipse_web@hotmail.com
**\\||It was recently discovered that research causes cancer in rats||//**
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top