Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to submit a form after jQuery modal confirmation dialog?
    primarykey
    data
    text
    <p>This script opens a jQuery dialog/modal to request verification prior to submitting the form, but when the user click on the "Submit" button in the modal window nothing happens. Firebug reveals that the issue is with the line containing, "document.leaveReq.submit();" I'm pretty new to jQuery and javascript, and have been struggling with this one for a few days. Any help here is much appreciated.</p> <pre><code>$(document).ready(function() { // jQuery UI Dialog $('#dialog').dialog({ autoOpen: false, width: 400, modal: true, resizable: false, buttons: { "Submit": function() { document.leaveReq.submit(); return true; }, "Cancel": function() { $(this).dialog("close"); return false; } } }); $('#formerror').dialog({ autoOpen: false, modal: true, resizable: false, buttons: { "Back": function() { $(this).dialog("close"); return false; } } }); $('#verify').click(function(e){ e.preventDefault(); if( !$("input#from").val() || !$("input#to").val()){ $("span#error-message").html('Provide a starting and ending date.'); $('#formerror').dialog('open'); } else if( $("input#amount").val() == 0 ){ $('#formerror').dialog('open'); $("span#error-message").html('Provide the number of units that you will use.'); } else if( !$("textarea#description").val() ){ $("span#error-message").html('Provide the reason for this leave request.'); $('#formerror').dialog('open'); } else { $("span#leavedescriptionidentification").html(document.getElementById('leave_description_identification').options[document.getElementById('leave_description_identification').selectedIndex].value); $("span#startingdate").html($("input#from").val()); $("span#endingdate").html($("input#to").val()); $("span#amount").html($("input#amount").val()); $("span#description").html($("textarea#description").val()); $('#dialog').dialog('open'); } return false; }); }); &lt;/script&gt; &lt;form action="/leave/lvereq" method="post" id="leaveReq" name="leaveReq" accept-charset="utf-8"&gt; &lt;div id="add"&gt; &lt;table&gt; &lt;tr&gt; &lt;td class="label"&gt;&lt;label for="leave_description_identification"&gt;Leave Type:&lt;/label&gt;&lt;/td&gt; &lt;td class="ret_text"&gt;&lt;select id="leave_description_identification" name="leave_description_identification" class="scrolledlist"&gt; &lt;option ...&gt;...&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="label"&gt;&lt;label for="starting_date"&gt;Start Date:&lt;/label&gt;&lt;/td&gt; &lt;td class="ret_text"&gt;&lt;input type="text" id="from" name="starting_date" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="label"&gt;&lt;label for="ending_date"&gt;Ending Date:&lt;/label&gt;&lt;/td&gt; &lt;td class="ret_text"&gt;&lt;input type="text" id="to" name="ending_date" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="label"&gt;&lt;label for="amount"&gt;Number of Units:&lt;/label&gt;&lt;/td&gt; &lt;td class="ret_text"&gt;&lt;input type="text" id="amount" name="amount" alt="signed_decimal_value_3" class="signed_decimal_value_3" onFocus="getCalc();" /&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td class="label"&gt;&lt;label for="description"&gt;Reason For Leave:&lt;/label&gt;&lt;/td&gt; &lt;td class="ret_text"&gt;&lt;textarea id="description" name="description" value="200" cols="60" rows="7" class="scrolledtext" wrap="soft"&gt;&lt;/textarea&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;div class="formButtons"&gt; &lt;span class="formButton"&gt; &lt;a id="verify" name="verify" href="#" class="ui-state-default ui-corner-all" style="padding:3px 8px;"&gt;Submit&lt;/a&gt; &lt;input type="submit" id="submit" name="submit" value="Submit" /&gt; &lt;/span&gt; &lt;/div&gt; &lt;/form&gt; &lt;div id="dialog" title="Confirmation"&gt; &lt;p&gt; &lt;span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 0 0;"&gt;&lt;/span&gt; Please verify the the information you entered is correct: &lt;/p&gt; &lt;p&gt; &lt;span class="label"&gt;Type:&lt;/span&gt; &lt;span id="leavedescriptionidentification"&gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="label"&gt;Dates:&lt;/span&gt; &lt;span id="startingdate"&gt;&lt;/span&gt; - &lt;span id="endingdate"&gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="label"&gt;Unit Amount:&lt;/span&gt; &lt;span id="amount"&gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="label"&gt;Reason:&lt;/span&gt; &lt;span id="description"&gt;&lt;/span&gt; &lt;/p&gt; &lt;p&gt;If this is correct, click Submit.&lt;/p&gt; &lt;p&gt;To edit, click Cancel.&lt;p&gt; &lt;/div&gt; &lt;div id="formerror" title="Error"&gt; &lt;p&gt;&lt;span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 0 0;"&gt;&lt;/span&gt; Please correct the following error:&lt;/p&gt; &lt;p&gt;&lt;span id="error-message"&gt;&lt;/span&gt;&lt;/p&gt; &lt;/div </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload