Link to home
Start Free TrialLog in
Avatar of Robert Granlund
Robert GranlundFlag for United States of America

asked on

jQuery Function Select onChange

I have a jQuery function that performs validation of a form when the submit button is pressed.  However, on this page there is a checkbox that when checked it completely clears the form.  The issue is, that there are two "Submit" Buttons on the page.  The first button is to update the form, the second is to submit the form.  How do I target the the "submit" button to run the validation, and not the update button?  I know this is probably simple but I can't seem to get my head around it.
ASKER CERTIFIED SOLUTION
Avatar of Brian Tao
Brian Tao
Flag of Taiwan, Province of China image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If I understand you correctly you have 2 buttons - one is Update the other Submit.
You want form validation to occur when you click Submit but not Update.
Is that correct?
If yes then
When you click Submit you call the validation only - do not call form submit from Submit click.
IF validation succeeds the form submit function is called from the validation function.
When you click Update the form submit function is called directly - the validation function is not called.

But I have to ask - why are there 2 submit buttons?
Do you mean that when the form is new then there is a Submit button but after the form is submitted then the button is an Update? There are not 2 buttons visible at the same time (one Update and one Submit). Like is in normal usage?
If that's the case then I understand.

Your description sounds like you have 2 buttons visible at the same time!
That scenario is where I'd wonder why you are doing that???

Anyway - if my above solution doesn't work then could you post some code please.