amavadia Posted March 4, 2012 Share Posted March 4, 2012 I have a form on my page with various elements and have created a seperate validate php page. At the bottom of my form I have a button (type="button"). When it is clicked, the data is posted to the validate page, and errors returned. If errors are returned it displays them, if not I want it to post and redirect to another page like a normal form. The problem I have is when I use a type="button" button, the first part works fine but obviously it does not post and redirect because it is not a submit button, but if I change the button type to submit, the .click() handler on the button does not seem to be firing and so the page is posted even without checking for errors. Should i be using a different handler on the submit button as opposed to a button button? Quote Link to comment https://forums.phpfreaks.com/topic/258249-submit-button-events/ Share on other sites More sharing options...
S3cr3t Posted March 4, 2012 Share Posted March 4, 2012 What about a form.submit() event in your button click event ? Quote Link to comment https://forums.phpfreaks.com/topic/258249-submit-button-events/#findComment-1323764 Share on other sites More sharing options...
amavadia Posted March 4, 2012 Author Share Posted March 4, 2012 Thank you. I did try that before as well but just realised the silly error i made... used the form name as the selector rather than form id Quote Link to comment https://forums.phpfreaks.com/topic/258249-submit-button-events/#findComment-1323768 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.