-
Notifications
You must be signed in to change notification settings - Fork 11
disable button to prevent double submit #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -156,16 +156,29 @@ | |
| > | ||
| "; | ||
| if ($SQL->accDeletionRequestExists($USER->uid)) { | ||
| echo "<input type='submit' value='Request PI Account' disabled />"; | ||
| echo " | ||
| <input | ||
| type='submit' value='Request PI Account' disabled | ||
| onclick='this.form.submit(); this.disabled=true;' | ||
| /> | ||
| "; | ||
| echo " | ||
| <label style='margin-left: 10px'> | ||
| You cannot request PI Account while you have requested account deletion. | ||
| </label> | ||
| "; | ||
| } else { | ||
| if ($SQL->requestExists($USER->uid)) { | ||
| $prompt = "onclick='return confirm(\"Are you sure you want to cancel this request?\")"; | ||
| echo "<input type='submit' value='Cancel PI Account Request' $prompt'/>"; | ||
| echo " | ||
| <input | ||
| type='submit' value='Cancel PI Account Request' | ||
| onclick=' | ||
| confirm(\"Are you sure you want to cancel this request?\") | ||
| && this.form.submit() | ||
| && this.disabled=true; | ||
| ' | ||
| /> | ||
| "; | ||
| echo " | ||
| <label style='margin-left: 10px'> | ||
| Your request has been submitted and is currently pending | ||
|
|
@@ -174,8 +187,16 @@ | |
| "; | ||
| } else { | ||
| echo "<input type='hidden' name='form_type' value='pi_request'/>"; | ||
| $prompt = "onclick='return confirm(\"Are you sure you want to request a PI account?\")"; | ||
| echo "<input type='submit' value='Request PI Account' $prompt'/>"; | ||
| echo " | ||
| <input | ||
| type='submit' value='Request PI Account' | ||
| onclick=' | ||
| confirm(\"Are you sure you want to request a PI account?\") | ||
| && this.form.submit() | ||
| && this.disabled=true; | ||
| ' | ||
| /> | ||
| "; | ||
| } | ||
| } | ||
| echo "</form>"; | ||
|
|
@@ -199,7 +220,10 @@ | |
| > | ||
| <input type='hidden' name='delIndex' value='$i' /> | ||
| <input type='hidden' name='form_type' value='delKey' /> | ||
| <input type='submit' value='×' /> | ||
| <input | ||
| type='submit' value='×' | ||
| onclick='this.form.submit(); this.disabled=true;' | ||
|
||
| /> | ||
| </form> | ||
| </div>"; | ||
| } | ||
|
|
@@ -216,12 +240,16 @@ | |
| echo "<option>$shell</option>"; | ||
| } | ||
| echo " | ||
| </select> | ||
| <br> | ||
| <input id='submitLoginShell' type='submit' value='Set Login Shell' /> | ||
| </form> | ||
| <hr> | ||
| <h5>Account Deletion</h5> | ||
| </select> | ||
| <br> | ||
| <input | ||
| type='submit' | ||
| id='submitLoginShell' value='Set Login Shell' | ||
| onclick='this.form.submit(); this.disabled=true;' | ||
| /> | ||
| </form> | ||
| <hr> | ||
| <h5>Account Deletion</h5> | ||
| "; | ||
|
|
||
| if ($hasGroups) { | ||
|
|
@@ -237,13 +265,23 @@ | |
| <input type='hidden' name='form_type' value='account_deletion_request' /> | ||
| "; | ||
| if ($SQL->accDeletionRequestExists($USER->uid)) { | ||
| echo "<input type='submit' value='Request Account Deletion' disabled />"; | ||
| echo " | ||
| <label style='margin-left: 10px'> | ||
| Your request has been submitted and is currently pending</label> | ||
| <input | ||
| type='submit' value='Request Account Deletion' | ||
| onclick='this.form.submit(); this.disabled=true;' | ||
| disabled | ||
| /> | ||
| <label style='margin-left: 10px'> | ||
| Your request has been submitted and is currently pending | ||
| </label> | ||
| "; | ||
| } else { | ||
| echo "<input type='submit' value='Request Account Deletion' />"; | ||
| echo " | ||
| <input | ||
| type='submit' value='Request Account Deletion' | ||
| onclick='this.form.submit(); this.disabled=true;' | ||
| > | ||
| "; | ||
| } | ||
| echo "</form>"; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -95,7 +95,10 @@ | |||||
| echo "<form action='' method='POST' id='cancelPI'> | ||||||
| <input type='hidden' name='pi' value='{$requested_account->gid}'> | ||||||
| <input type='hidden' name='form_type' value='cancelPIForm'> | ||||||
| <input name='cancel' style='margin-top: 10px;' type='submit' value='Cancel Request'/> | ||||||
| <input | ||||||
| name='cancel' style='margin-top: 10px;' type='submit' value='Cancel Request' | ||||||
| onclick='this.form.submit(); this.disabled=true;' | ||||||
| /> | ||||||
| </form>"; | ||||||
| echo "</td>"; | ||||||
| echo "</tr>"; | ||||||
|
|
@@ -144,7 +147,7 @@ | |||||
| onsubmit='return confirm(\"Are you sure you want to leave the PI group " . $group->gid . "?\")'> | ||||||
| <input type='hidden' name='form_type' value='removePIForm'> | ||||||
| <input type='hidden' name='pi' value='" . $group->gid . "'> | ||||||
| <input type='submit' value='Leave Group'> | ||||||
| <input type='submit' value='Leave Group' onclick='this.form.submit(); this.disabled=true;'> | ||||||
|
||||||
| <input type='submit' value='Leave Group' onclick='this.form.submit(); this.disabled=true;'> | |
| <input type='submit' value='Leave Group' onclick='this.disabled=true; return true;'> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -13,7 +13,7 @@ | |||||
| <input type="text" id="pi_search" name="pi" placeholder="Search PI by NetID" required> | ||||||
| <div class="searchWrapper" style="display: none;"></div> | ||||||
| </div> | ||||||
| <input type="submit" value="Send Request"> | ||||||
| <input type="submit" value="Send Request" onclick="this.form.submit(); this.disabled=true;"> | ||||||
|
||||||
| <input type="submit" value="Send Request" onclick="this.form.submit(); this.disabled=true;"> | |
| <input type="submit" value="Send Request" onclick="this.disabled = true; return true;"> |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -103,7 +103,10 @@ | |||||
| <p>You may need to remind them.</p> | ||||||
| <hr> | ||||||
| <form action="" method="POST"> | ||||||
| <input name="cancel" style='margin-top: 10px;' type='submit' value='Cancel Request'/> | ||||||
| <input | ||||||
| name="cancel" style='margin-top: 10px;' type='submit' value='Cancel Request' | ||||||
| onclick='this.form.submit(); this.disabled=true;' | ||||||
|
||||||
| onclick='this.form.submit(); this.disabled=true;' | |
| onclick='this.disabled = true; return true;' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Programmatic submit bypasses onsubmit/validation and the handler doesn't prevent the default, so the native submit also occurs—risking double-submit. Use: onclick='this.disabled = true; return true;'