I have a form which has a button. The processing code after submission is written in Button.onSubmit() and Form.onSubmit() is not overridden. Now, when I add a JavaScript confirmation asking if the user is ready to submit the form. The JavaScript performs $('#formId').submit(). The form submission does not take place. (page refreshes but no submission)
On debugging, I realized that if I perform JavaScript form submission (using $('#formId').submit()) -- the control never goes to Button.onSubmit(), rather it goes to only to Form.onSubmit(). So, my page just reloads. Is there a work-around so that if I perform $('#formId').submit() on front-end -- the submit button's onSubmit() get called? I would be reluctant to move code from Button.onSubmit() to Form.onSubmit() because I have many forms where submission logic is written in Button.onSubmit() and I may need to change those as well. ----------- I am currently trying to simulate JavaScript's confirm behavior for button, so that Button.onSubmit() get's the control when confirms the dialog. It's here http://stackoverflow.com/questions/3560872/returning-value-from-confirmation-dialog-using-jquery-ui-dialog Thanks Nishant