users@woodstock.java.net

RE: Submit and disable a button

From: Steffen <iolaus_at_gmx.ch>
Date: Thu, 2 Oct 2008 15:11:13 +0200

Sorry for my little answer. So, I have a false return statement in the
onClick method, in a ui-component.



// js script example

<webuijsf:script>
      function doSomething() {
          var userInput = confirm("got it?");
          
          if ( userInput ) {
                document.getElementById("form1:btnLogin").click() = true;
          }
      }
</webuijsf:script>




// Button and textfield

<webuijsf:form id="form1">

  <webuijsf:textField binding="#{Page1.textField1}" id="textField1"/>
  
  <webuijsf:button actionExpression="#{Page1.btnLogin_action}" id="btnLogin"
     onClick="doSomething(); return false;"/>

</webuijsf:form>




// action handler for the btnButton

public String btnLogin_action() {
      textField1.setText("Hello Steve, it works!");
      return null;
}



I hope it is helpful..


Greetings




-----Original Message-----
From: Stefan Bley [mailto:stefan.bley_at_saxsys.de]
Sent: Donnerstag, 2. Oktober 2008 14:09
To: users_at_woodstock.dev.java.net
Subject: RE: Submit and disable a button


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
>
>

-- 
View this message in context:
http://www.nabble.com/Submit-and-disable-a-button-tp16322463p19777999.html
Sent from the Project Woodstock - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_woodstock.dev.java.net
For additional commands, e-mail: users-help_at_woodstock.dev.java.net