users@woodstock.java.net

Re: Submit and disable a button

From: Federico Vela <fvela_at_paysett.com>
Date: Thu, 02 Oct 2008 08:07:22 -0500

I am using a slightly different approach with a "BUSY" progress bar to
replace the buttons and it works really well.

I put all the buttons in its own panel grid next to the progress bar
which is hidden at first. in the onClick i put "return
myJavascriptFunction();" which always returns true.

in the javascript function i do

document.getElementById("progressBar").setProps({visible : true});
document.getElementById("buttonsPanelGroup").style.display = 'none';
return true;

Voila!

Federico Vela


Stefan Bley wrote:
> Could you please show this in context?
> Where did you put this statement and what is this supposed to do?
>
> Like that?
>
> <!-- code -->
> <webuijsf:script>
> function login() {
> document.getElementById("form1:btnLogin").setProps({disabled:
> true});
> document.getElementById("form1:btnLogin").click() = true;
> }
> </webuijsf:script>
> <webuijsf:button actionExpression="#{login$Login.handleBtnLogin}"
> id="btnLogin" text="Login" onClick="login()"/>
> <!-- end of code -->
>
> Stevy
>
>
> IOLAUS wrote:
>> Hello List,
>>
>> I had the same trouble and I've fixed it with JavaSctipt. Like
>> "document.getElementById("form1:yourButton").click() = true;".
>>
>>
>> Greets
>>
>> The reason is to tell the user "Your request is processing, please wait
>> and
>> do not click again until the request is completed." This is very common,
>> e.g. see Glassfish Admin Console.
>>
>> The problem is: If you use onClick() and set the button disabled, the form
>> is not submitted.
>> How can one have both, disable the button and submit the form?
>>
>> Stevy
>>
>>
>