javascript - Get dialog box value to determine submit the form or not -
i have form this:
<form action="confirm-and-send.php" method="post" onsubmit="return(confirmation());"> <input lot of input fields here> <button type="submit" name="confirm_and_send" id="submit-button" class="sent-to-client-bttn" style="margin-left:630px;margin-top: -125px;"></button> </form>
then have jquery ui function
function confirmation(){ $("#some-div").dialog({ bgiframe: true, autoopen: false, minheight: 200, width: 350, modal: true, closeonescape: false, draggable: false, resizable: false, buttons: { 'yes': function(){ $(this).dialog('close'); callback(true); }, 'no': function(){ $(this).dialog('close'); callback(false); } } }); } function callback(value){ //do }
i following here , here, didn't work me. if put event.preventdefault()
yes button not submit for; if don't put submits form before choose of 2 options. can give me proper example?
take button outside of form.
<form action="" method="post" id="my_form" onsubmit=""> <input type="text" name="x"/> </form> <button name="confirm_and_send" id="submit-button" value="submit" class="sent-to-client-bttn" onclick="confirmation();">submit</button> <div id="some-div" style="display:none">hi</div> function confirmation(){ $("#some-div").dialog({ bgiframe: true, minheight: 200, width: 350, modal: true, closeonescape: false, draggable: false, resizable: false, buttons: { 'yes': function(){ $(this).dialog('close'); callback(true); }, 'no': function(){ $(this).dialog('close'); callback(false); } } }); } function callback(value){ alert(value); }
Comments
Post a Comment