Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One solution is to use Javascript and a hidden field</p> <pre><code> &lt;input type="hidden" name="actionparam" value="DoNothing"&gt; &lt;input type="button" onclick="OnSubmitForm('ActionA')" Value="Click Here for A" /&gt; &lt;input type="button" onclick="OnSubmitForm('ActionB')" Value="Click Here for B" /&gt; function OnSubmitForm(actionname) { var f = document.frm; f.actionparam.value = actionname; f.submit(); } </code></pre> <p>This works as a hidden CATPCHA also, and you can add some client validation in the javascript function</p> <h2>Edit:</h2> <p>Since you say you want to degrade to non-javascript browsers, you can use this version, that allow only one default action to the people with no javascript</p> <p>The extra buttons are disabled in HTML but then re-enabled with javascript.<br> Tested code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript"&gt; &lt;!-- function OnSubmitForm(actionname) { var f = document.frm; f.actionparam.value = actionname; f.submit(); } //--&gt; &lt;/SCRIPT&gt; &lt;/head&gt; &lt;body&gt; &lt;noscript&gt; &lt;div style="background-color: yellow; margin: 20px;" &gt; You are using a limited version of the site because you don't have Javascript enabled &lt;/div&gt; &lt;/noscript&gt; &lt;h1&gt;form&lt;/h1&gt; &lt;form name="frm" method="post"&gt; &lt;input type="hidden" name="actionparam" value="DefaultAction" /&gt; &lt;button name="defaultbutton" type="submit"&gt;default action&lt;/button&gt; &lt;button name="extrabutton1" disabled onclick="OnSubmitForm('ExtraAction1')"&gt;Extra action 1&lt;/button&gt; &lt;button name="extrabutton2" disabled onclick="OnSubmitForm('ExtraAction2')"&gt;Extra action 2&lt;/button&gt; &lt;/form&gt; &lt;h1&gt;Results&lt;/h1&gt; &lt;h2&gt;forms collection&lt;/h2&gt; &lt;ol&gt; &lt;% For x = 1 To Request.Form.count() Response.Write("&lt;li&gt;" + Request.Form.key(x) + "=" + Request.Form.item(x) + "&lt;/li&gt;") Next %&gt; &lt;/ol&gt; &lt;script type="text/javascript"&gt; &lt;!-- document.frm.extrabutton1.disabled = false; document.frm.extrabutton2.disabled = false; //--&gt; &lt;/SCRIPT&gt; &lt;/body&gt; &lt;/html&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