Note that there are some explanatory texts on larger screens.

plurals
  1. POClarification on temporarily disabling a submit button for a number seconds, then re-enable it?
    primarykey
    data
    text
    <p>This is similiar to another question that was asked however the form will not submit.</p> <p>Basically what I am trying achieve here is that once the user clicks the "submit" btn , the btn is disabled until the page is re-directed, so as to avoid the user clicking the submit btn several times.</p> <p>The page that the user is re-directed to will not display the information from the form. This did function correctly before I introduced the disable and enable functions.</p> <p>The code provided does disable the btn and even changes the text to "submitting" but does not not re-direct to the summary page, and even when I navigate to the summary page via a tab the information is not there. Any help is most appreciated...</p> <p>form code........</p> <pre><code> &lt;div class="portlet-body form"&gt; &lt;!-- BEGIN FORM--&gt; @using (Html.BeginForm("RequestAppointment", "Appointment", new { ReturnUrl = ViewBag.ReturnUrl }, FormMethod.Post, new { @class = "form-horizontal", id= "apptReqForm" })) { @Html.AntiForgeryToken() @Html.ValidationSummary(false, string.Empty, new { @class = "alert alert-error" }) &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;Healthcare Professional&lt;/label&gt; &lt;div class="controls"&gt; @Html.DropDownListFor(m =&gt; m.RequestedUserID, Model.Hcps, string.Empty) &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;@Html.LabelFor(m =&gt; m.RequestedDateTime)&lt;/label&gt; &lt;div class="controls"&gt; &lt;div class="input-append" id="ui_date_picker_trigger"&gt; @Html.EditorFor(m =&gt; m.RequestedDateTime) &lt;span class="add-on"&gt;&lt;i class="icon-calendar"&gt;&lt;/i&gt;&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;@Html.LabelFor(m =&gt; m.SelectedTime, "Time")&lt;/label&gt; &lt;div class="controls"&gt; &lt;div id="timeSlotID" data-request-url="@Url.Action("LoadTimeslots")"&gt; &lt;select id="SelectedTime" name="SelectedTime"&gt;&lt;/select&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="control-group"&gt; &lt;label class="control-label"&gt;@Html.LabelFor(m =&gt; m.AdditionalNotes)&lt;/label&gt; &lt;div class="controls"&gt; @Html.TextAreaFor(m =&gt; m.AdditionalNotes, new { @class = "span6 m-wrap", rows = 3 }) &lt;span class="help-block m-wrap"&gt;In the event the selected time you have chosen is not available, please state above if your booking time is flexible.&lt;/span&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="form-actions"&gt; &lt;button type="submit" class= "btn blue" id="submit" onclick="disable();"&gt;&lt;i class="icon-ok"&gt;&lt;/i&gt;Submit&lt;/button&gt; &lt;button type="button" class="btn" onclick="location.href='RequestedAppointments'"&gt;Cancel&lt;/button&gt; &lt;/div&gt; } &lt;/div&gt; &lt;div class="form-actions"&gt; &lt;button type="submit" class= "btn blue" id="submit" onclick="disable();"&gt;&lt;i class="icon-ok"&gt;&lt;/i&gt;Submit&lt;/button&gt; &lt;script&gt; function disable() { x = document.getElementById("submit"); x.disabled = true; x.textContent = "Submitting..."; document.getElementById("apptReqForm").submit(); setTimeout(enable, 5000); } function enable() { x = document.getElementById("submit"); x.disabled = false; x.textContent = " Submit"; } &lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
 

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