users@woodstock.java.net

RE: Submit and disable a button

From: Stefan Bley <stefan.bley_at_saxsys.de>
Date: Fri, 10 Oct 2008 02:21:16 -0700 (PDT)

Hi Steffen,

unfortunately it is not that easy. The form is submitted, but you don't end
in your button's action listener.
Here is a solution to this problem. I found the important line in the
glassfish admin console sources and... it works! :-)

function submitAndDisable(button, msg) {
    button.setProps({disabled: true, value: msg});
    button.form.action += "?" + button.name + "=" + encodeURI(button.value);
// important line
    button.form.submit();
    return true;
}

<webuijsf:button id="btnLogin" actionExpression="#{Login.handleBtnLogin}"
onClick="submitAndDisable(this, 'Please wait...');" text="Login" />


IOLAUS wrote:
>
> Hi Stefan,
>
> To disable the Button and submit the form after press is easy. See the TLD
> Doc about that or try the code until this text.
>
>
> // Write this code in your Button onClick method.
> "btnLogin" call the id of your Button
>
> domNode=document.getElementById("form1:btnLogin");
> domNode.setProps({disabled:true});
>

-- 
View this message in context: http://www.nabble.com/Submit-and-disable-a-button-tp16322463p19914888.html
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.