Reputation: 111
I've created one CTP file in CakePHP. In that I've created one form with the submit button.
<?php echo $form->create(BILLING_DETAIL, array('url'=>'/fbilling_details/subscription/','id'=>'billing'));?>
<?php echo $form->submit('SAVE', array('type'=>'submit','name'=>'saveSubscription', 'id'=>'saveSubscription','onclick'=>'return confirm_subscription('."'".$billing_info[0][ACCOUNT_TYPE]['tx_acc_name']."'".','."'".$billing_info[0][PLAN]['nu_actual_price']."'".')')); ?>
And my function for JavaScript is somewhat like this:
function confirm_subscription(plan_name,mon){
// confirm dialog
jQuery.jqDialog.confirm("Current Plan | "+plan_name+" "+mon,
function() {
jQuery("#billing").submit();
//return true;
}, // callback function for 'YES' button
function() {
return false;
} // callback function for 'NO' button
);
return false;
}
But I can't submit the form with this. Please anybody can help me. Thanks in advance. :)
Upvotes: 0
Views: 942
Reputation: 116110
The JQuery sumbit methods binds a function to the submit event. To submit the form itself, you should call the submit method of the form element.
$('#billing').get(0).submit();
Upvotes: 1