Note that there are some explanatory texts on larger screens.

plurals
  1. POLinkButton as a Default Button
    primarykey
    data
    text
    <p>I'm using linkbuttons in my web applications, my 'composite controls' aren't using ASP Panels (therefore no 'DefaultButton' property, not that it would work). My link buttons currently have the href set as 'javascript:_doPostBack..' (asp default), but to enable my custom client side validation script, I ALSO have code in an 'onclick' attribute.</p> <p>Typical Button :</p> <pre><code>&lt;div class="button orange o_lime right Normal"&gt; &lt;a onclick="if (!validateFormmainContent_Login()) return false;" id="mainContent_Login_ctl09_mainContent_Login_btnSubmit" defaultB="loginForm" href="javascript:__doPostBack(&amp;#39;ctl00$mainContent$Login$ctl09$mainContent_Login_btnSubmit&amp;#39;,&amp;#39;&amp;#39;)"&gt; Submit &lt;/a&gt; &lt;/div&gt; </code></pre> <p>Typical Form row requiring 'default button' action</p> <pre><code>&lt;div class='row' ID='mainContent_Login_ctl03'&gt; &lt;label ID='mainContent_Login_ctl04'&gt;Email/Username&lt;/label&gt; &lt;input name="ctl00$mainContent$Login$txtAccount" type="text" id="mainContent_Login_txtAccount" class="lime validate[required]" defaultB="loginForm" /&gt; &lt;/div&gt; </code></pre> <p>My current attempt at code to make this work :</p> <pre><code>&lt;script type="javascript"&gt; $('input[defaultB]').keypress(function (e) { if ((e.which &amp;&amp; e.which == 13) || (e.keyCode &amp;&amp; e.keyCode == 13)) { $('a[defaultB=' + $(e.srcElement).attr('defaultB') + ']').click(); return false; } else { return true; } }); </code></pre> <p></p> <p>My current attempted solution assigns a value to 'defaultB' with something that matches the 'defaultB' value defined in a corresponding button, such that key press '13' (enter) should initiate the 'click' event. but nothing is happening :(</p> <p>I've created a jsfiddle to help, but it isn't working with stupid 'cant find function' exception. :( </p> <p><a href="http://jsfiddle.net/Ninjanoel/yQvKC/" rel="nofollow">http://jsfiddle.net/Ninjanoel/yQvKC/</a></p> <p>I'd really like to get this working without having to rework all my controls! Can anyone help?</p>
    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.
    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