You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Stephan Windmüller <st...@tu-dortmund.de> on 2015/01/23 13:32:00 UTC

Checkbox value for zone update

Hello,

according to the Tapestry documentation, zones cannot be updated by
checkboxes. I found some information on this topic, primarily in this
mailing list, for how to circumvent this problem.

My current approach is to use tapestry5-jquery:


<t:checkbox t:id="valueCheckBox"
	value="ignoreLengthSelected"
	t:mixins="jquery/bind"
	bind.event="lengthChange"
	bind.eventtype="change"
	bind.zone="resultZone"/>

public Object onValueChange() {
	return resultZone.getBody();
}


However, I do not know how to access the value of the checkbox.
Injecting the component does not help because it does not provide
methods to read the state. Adding a parameter to onValueChange also does
not work.

Does anyone know how to use a checkbox this way?

TIA
 Stephan

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


Re: Checkbox value for zone update

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
On 23.01.2015, Chris Poulsen wrote:

> We have a "submittingcheckbox" component for this kind of thing. Basically
> the component renders a checkbox and a hidden submit.

Thanks for the suggestion, but using a separate submit field sounds a
bit complex for such a simple task. I refuse to believe that there is no
other way. ;)

- Stephan

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


Re: Checkbox value for zone update

Posted by Chris Poulsen <ma...@nesluop.dk>.
Hi,

We have a "submittingcheckbox" component for this kind of thing. Basically
the component renders a checkbox and a hidden submit.

An onChange handler on the checkbox clicks the submit

Example usage (T5.4):
 <t:form t:id="selectActionForm" async="true" context="actionRow.original.id
">
    <t:submittingcheckbox value="actionSelected" appearance="inline"
label="" />
</t:form>

Form context can be used for setting up the environment if needed (can be
handled in EventConstants.PREPARE_SUBMIT handler - the example above is
from a data table cell) and the value of the checkbox is properly bound
when handling the EventConstants.SUCCESS event  for the form (where you can
use ajax response renderer to perform zone updates etc)

If you are using t5-jquery you are probably not on 5.4 - so you would need
to replace the form.async with the 5.3 zone equivalent.

HTH
-- 
Chris

On Fri, Jan 23, 2015 at 1:32 PM, Stephan Windmüller <
stephan.windmueller@tu-dortmund.de> wrote:

> Hello,
>
> according to the Tapestry documentation, zones cannot be updated by
> checkboxes. I found some information on this topic, primarily in this
> mailing list, for how to circumvent this problem.
>
> My current approach is to use tapestry5-jquery:
>
>
> <t:checkbox t:id="valueCheckBox"
>         value="ignoreLengthSelected"
>         t:mixins="jquery/bind"
>         bind.event="lengthChange"
>         bind.eventtype="change"
>         bind.zone="resultZone"/>
>
> public Object onValueChange() {
>         return resultZone.getBody();
> }
>
>
> However, I do not know how to access the value of the checkbox.
> Injecting the component does not help because it does not provide
> methods to read the state. Adding a parameter to onValueChange also does
> not work.
>
> Does anyone know how to use a checkbox this way?
>
> TIA
>  Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Checkbox value for zone update

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
On 23.01.2015, Thiago H de Paula Figueiredo wrote:

> You access the value of the checkbox (or any other Tapestry form field
> component) by accessing the property it's editing. It the case above,
> the ignoreLengthSelected property.

This does not work with the zone update, the value is always false.

- Stephan

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


Re: Checkbox value for zone update

Posted by Thiago H de Paula Figueiredo <th...@gmail.com>.
On Fri, 23 Jan 2015 10:32:00 -0200, Stephan Windmüller  
<st...@tu-dortmund.de> wrote:

> Hello,

Hi!

> <t:checkbox t:id="valueCheckBox"
> 	value="ignoreLengthSelected"

> However, I do not know how to access the value of the checkbox.

You access the value of the checkbox (or any other Tapestry form field  
component) by accessing the property it's editing. It the case above, the  
ignoreLengthSelected property.

-- 
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

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


Re: Checkbox value for zone update

Posted by Lance Java <la...@googlemail.com>.
I'm guessing you have a javascript error on your page.

Are you using jquery or prototype? tapestry-stitch only works for
prototype. You'll need to tweak observe. js to get it to work with jquery
(eg observe() changed to on() etc)
On 26 Jan 2015 09:17, "Stephan Windmüller" <
stephan.windmueller@tu-dortmund.de> wrote:

> On 23.01.2015, schrieb Lance Java wrote:
>
> > You could use the observe mixin from tapestry stitch. The mixin can fire
> a
> > zone update based on the change event, the current checkbox value can be
> > sent as the event context.
>
> Hey Lance,
>
> your project sounds very promising, thanks for the hint. But are you
> sure that is works with checkboxes? According to Chrome, there is no
> event listener registered for "change" with this code:
>
>
> <t:checkbox value="ignoreValueSelected"
>         t:mixins="stitch/observe"
>         clientEvent="click"
>         event="updateLength"
>         zone="resultZone"/>
>
> - Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: Checkbox value for zone update

Posted by Stephan Windmüller <st...@tu-dortmund.de>.
On 23.01.2015, schrieb Lance Java wrote:

> You could use the observe mixin from tapestry stitch. The mixin can fire a
> zone update based on the change event, the current checkbox value can be
> sent as the event context.

Hey Lance,

your project sounds very promising, thanks for the hint. But are you
sure that is works with checkboxes? According to Chrome, there is no
event listener registered for "change" with this code:

								<t:checkbox value="ignoreValueSelected"
	t:mixins="stitch/observe"
	clientEvent="click"
	event="updateLength"
	zone="resultZone"/>

- Stephan

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


Re: Checkbox value for zone update

Posted by Lance Java <la...@googlemail.com>.
You could use the observe mixin from tapestry stitch. The mixin can fire a
zone update based on the change event, the current checkbox value can be
sent as the event context.

http://t5stitch-lazan.rhcloud.com/observedemo
On 23 Jan 2015 12:33, "Stephan Windmüller" <
stephan.windmueller@tu-dortmund.de> wrote:

> Hello,
>
> according to the Tapestry documentation, zones cannot be updated by
> checkboxes. I found some information on this topic, primarily in this
> mailing list, for how to circumvent this problem.
>
> My current approach is to use tapestry5-jquery:
>
>
> <t:checkbox t:id="valueCheckBox"
>         value="ignoreLengthSelected"
>         t:mixins="jquery/bind"
>         bind.event="lengthChange"
>         bind.eventtype="change"
>         bind.zone="resultZone"/>
>
> public Object onValueChange() {
>         return resultZone.getBody();
> }
>
>
> However, I do not know how to access the value of the checkbox.
> Injecting the component does not help because it does not provide
> methods to read the state. Adding a parameter to onValueChange also does
> not work.
>
> Does anyone know how to use a checkbox this way?
>
> TIA
>  Stephan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>