You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Grigoris Ioannou <ho...@gmail.com> on 2008/03/18 13:00:31 UTC

T4.1.3 How to disable a submit button programmatically?

Hi all,

I have a Submit button in my form that I want to have disabled and to only
be disabled if the form does not contain any errors and the form is not
rewinding.

So, what I would like to do is (I assume)
public void pageBeginRender(PageEvent event) {
   disable button ???
}

if (!delegate.getHasErrors()) {
 enable button ???
}

Is this possible? I looked at the tapestry API and I found code similar to

Submit reservationButton = (Submit) getComponent("submitReservationButton");
IBinding b = (IBinding) component.getBinding("disabled");

but I cant set a new value (i.e. "ognl:false") to the button. How to do it?
Any help would be appreciated

Grigoris

Re: T4.1.3 How to disable a submit button programmatically?

Posted by Andreas Andreou <an...@gmail.com>.
Just bind the 'disabled' parameter of your submit to a property
and get/set that property according to your conditions...

On Tue, Mar 18, 2008 at 2:00 PM, Grigoris Ioannou
<ho...@gmail.com> wrote:
> Hi all,
>
>  I have a Submit button in my form that I want to have disabled and to only
>  be disabled if the form does not contain any errors and the form is not
>  rewinding.
>
>  So, what I would like to do is (I assume)
>  public void pageBeginRender(PageEvent event) {
>    disable button ???
>  }
>
>  if (!delegate.getHasErrors()) {
>   enable button ???
>  }
>
>  Is this possible? I looked at the tapestry API and I found code similar to
>
>  Submit reservationButton = (Submit) getComponent("submitReservationButton");
>  IBinding b = (IBinding) component.getBinding("disabled");
>
>  but I cant set a new value (i.e. "ognl:false") to the button. How to do it?
>  Any help would be appreciated
>
>  Grigoris
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org