You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Carpels Pascal <Pa...@sycron-it.com> on 2004/08/25 11:50:42 UTC

Add listener to component

Hello,

Is it possible to add a listener to a checkbox component ?

I would like to know (immediately) when the state of the checkbox
changes...

Best regards,

Pascal.


Re: Add listener to component

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Aug 25, 2004, at 4:50 AM, Carpels Pascal wrote:
> Hello,
>
> Is it possible to add a listener to a checkbox component ?

Not quite....

> I would like to know (immediately) when the state of the checkbox
> changes...

The form the checkbox is in needs to be submitted, so the listener 
would be the @Form listener.

@PropertySelection supports a 'submitOnChange' attribute, but all that 
does is add a bit of JavaScript, but @Checkbox does not.  It's easily 
added though.  The Workbench application on the Fields tab has an 
example of exactly what you're asking for.  From Fields.page:

   <component id="inputEnabled" type="Checkbox">
     <binding name="selected" expression="clientValidationEnabled"/>
     <static-binding name="onclick">
     	javascript:this.form.submit();
     </static-binding>
   </component>

Erik


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