I am trying to convert an existing HTML form and make it appear in JQuery dialog. I am not sure how to change the code so the data is submitted after clicking the submit buton. My code is a follows:
Old form:
<form method="post" name="callbackrequest" id="ccallbackrequest" action="action.php" onsubmit="return validateThis(this)">
<button type="submit" class="submit">Submit Request</button>
New form:
buttons: {
"Submit": function() {
if ( bValid ) {
HERE GOES THE CODE!
$( this ).dialog( "close" );
}
Then there is the new form:
<form class="center" method="post" name="callbackrequest" id="ccallbackrequest" action="??">
fields listed
no submit button
</form>
Any advice on how should I handle this?
Try $('#ccallbackrequest').submit();
. The submit method just submits whichever form is returned by the selector.