JQuery UI dialog not passing form variables after preventdefault -
i believe i'm doing wrong here. have perl script says "if not submit button name submit/save, display html page. on submit, run subroutines pretty insert6/update data db.
if ($cgi->param("group_submit") eq '') { &display_add_promo(); exit(0); } else { &group_product($group_id); $group_page = "./group?group_id=$group_id"; print $cgi->redirect($group_page); &close_and_exit; } exit(0);
now using jquery check if "product new promotion code assigned contained within old promotion code assigned , if through alert.
\$('#dialog').dialog({ height: 270, width: 500, autoopen: false, modal: true, buttons: { 'continue': function(event) { \$(event.target).css({opacity: 0.25}).unbind(); \$('#my_form').unbind('submit').submit(); \$(this).dialog('close'); }, 'cancel': function(event) { \$(event.target).css({opacity: 0.25}).unbind(); \$(this).dialog('close'); } } }); \$('#my_form').submit(function(event) { \$.each(\$('#new_products').val().split(''), function(i, char) { var existing = \$('#existing_products').val(); if (existing.indexof(char) != -1) { event.preventdefault(); \$('#dialog').dialog('open'); } }); });
now when dialog comes , hit "continue" script posts, same page says mozilla web console , none of perl logic runs , seems page refreshes. in advance help!
the solution simulate submit click , run of pending logic on submit was:
$('.group_submit').trigger('click');
Comments
Post a Comment