Note that there are some explanatory texts on larger screens.

plurals
  1. PORemove Submit Button if the form is validated
    text
    copied!<p>I am using Magento and created a custom form, and basically what I want to do is prevent a submit button to be click more than once (whether that is a double click, or if the user just gets impatient and clicks the button again after a few seconds). </p> <p>The form is using the Magento Javascript validation method to validate the fields and IF the fields are all validated then what I would like to do is to remove the submit button on the first click and replace it with a "In process..." message. This way there is no way that a user can double click or multiple click the button.</p> <p>If the fields are not all validated then move the submit button down and just above it display a message that may read "Please fill out all required fields and submit form again".</p> <p>Below is the form with just validation, but I would really like to know how to apply the what I mentioned above.</p> <p>Any help would be SO appreciated!!! Thanks in advance.</p> <pre><code>&lt;form name="&lt;em&gt;&lt;strong&gt;my-custom-form&lt;/strong&gt;" id="my-custom-form" action="" method="post"&gt; &lt;label for="firstname"&gt;&lt; ?php echo $this-&gt;__('First name') ?&gt; &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;br /&gt; &lt;input id="firstname" name="firstname" class="&lt;em/&gt;&lt;strong&gt;input-text required-entry&lt;/strong&gt;" /&gt; &lt;label for="lastname"&gt;&lt; ?php echo $this-&gt;__('Last name') ?&gt; &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;br /&gt; &lt;input id="lastname" name="lastname" class="&lt;em/&gt;&lt;strong&gt;input-text required-entry&lt;/strong&gt;" /&gt; &lt;label for="useremail"&gt;&lt; ?php echo $this-&gt;__('Email') ?&gt; &lt;span class="required"&gt;*&lt;/span&gt;&lt;/label&gt;&lt;br /&gt; &lt;input type="text" name="useremail" id="useremail" class="&lt;em/&gt;&lt;strong&gt;input-text required-entry validate-email&lt;/strong&gt;" /&gt; &lt;input type="submit" name="submit" value="&lt;?php echo $this-/&gt;__('Submit') ?&gt;" /&gt; &lt;/form&gt;&lt; ?php /* END OF my-custom-form */?&gt; &lt;script type="text/javascript"&gt; //&lt; ![CDATA[ var customForm = new VarienForm('&lt;em&gt;&lt;strong&gt;my-custom-form&lt;/strong&gt;'); //]]&gt; &lt;/script&gt; </code></pre>
 

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