You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Peter Stavrinides <p....@albourne.com> on 2008/04/23 16:24:50 UTC

How to update a list from a checkbox in a loop in t5

Hi All

I this scenario:
<t:loop source="myDOA" value="selectedDOA" encoder="encoder">
            <t:checkbox t:id="archived" />
 </t:loop>

How do I use the checkbox correctly when the user clicks it? 'I want to 
associate it with an object' via a primary key perhaps...but the 
checkbox only seems to have a value property of the type boolean:

http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html

Sorry if this question seems trivial, but I have been scratching my head 
for a while now.

thanks,
Peter

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


Re: How to update a list from a checkbox in a loop in t5

Posted by Peter Stavrinides <P....@albourne.com>.
Thanks Josh, I guess my approach was probably wrong to begin with, but this looks good, will give it a try. I also agree the checkbox could do with another attribute perhaps a context? which would make it a little easier to work with. 

Thanks everyone for your responses!
Peter

----- Original Message -----
From: "Josh Canfield" <jo...@thedailytube.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, 24 April, 2008 9:44:40 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: How to update a list from a checkbox in a loop in t5

The way checkbox works out of the box you need to coordinate with the
loop via the index or value parameter, as others have suggested. This
works but can be dangerous if your loop source happens to change
between the form render and the form submit. Try this extension so you
can bind a data value to the checkbox.

import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.corelib.components.Checkbox;
import org.apache.tapestry.ioc.annotations.Inject;

/**
 * <t:datacheckbox t:value="checked" t:data="data" />
 */
public class DataCheckbox extends Checkbox {

	@Parameter
	private String _data;
	
	@Inject
	private org.apache.tapestry.services.Request _request;
	protected void beforeRenderTemplate(MarkupWriter writer) {
		writer.attributes("value", _data);
	}
	
	@Override
	protected void processSubmission(String elementName) {
		super.processSubmission(elementName);
		String value = _request.getParameter(elementName);
		if ( value != null ) {
			_data = value;
		}
	}
}

You still have to provide the boolean value, but you can now also
provide a data parameter. While the boolean parameter will get set for
every instance of the checkbox, this extension only gets set if the
checkbox was checked.

I'd love to see the core checkbox component support more than boolean values...
Josh

On Thu, Apr 24, 2008 at 3:59 AM, Peter Stavrinides
<P....@albourne.com> wrote:
> Hi Nicholas
>
> This is simply boilerplate code:
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>      <t:checkbox t:id="archived" value="archive" />
> </t:loop>
>
>
> Archive is a read only boolean (no setter permitted), no model or encoder is available, which = no easy way to update like say if this was a textfield, making the checkbox not very useful in a loop!
>
> Peter
>
>
>
> ----- Original Message -----
> From: "nicholas Krul" <ni...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Thursday, 24 April, 2008 1:13:44 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
> Subject: Re: How to update a list from a checkbox in a loop in t5
>
> Perhaps some code would help us out.
>
> .tml loop & checkbox snippet
>
> .java index & getter & setter snippet
>
>
> ? I can only try
>
> On Thu, Apr 24, 2008 at 10:54 AM, Peter Stavrinides <
> p.stavrinides@albourne.com> wrote:
>
> > I have also noticed that the value parameter on the checkbox component is
> > a read only boolean, so using accessors to write the value is impossible,
> > which confirms the checkbox is not usable in this way in a loop.
> >
> >
> > Peter Stavrinides wrote:
> >
> > > Sorry, let me try rephrasing my question:
> > >
> > > When I click on the checkbox, how do I modify the corresponding object
> > > in the loop? The only way I can see of doing this is to iterate manually, in
> > > which case a Tapestry checkbox component is not usable in a loop.
> > >
> > > Peter
> > >
> > > Peter Stavrinides wrote:
> > >
> > > > Hi All
> > > >
> > > > I this scenario:
> > > > <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
> > > >           <t:checkbox t:id="archived" />
> > > > </t:loop>
> > > >
> > > > How do I use the checkbox correctly when the user clicks it? 'I want
> > > > to associate it with an object' via a primary key perhaps...but the checkbox
> > > > only seems to have a value property of the type boolean:
> > > >
> > > >
> > > > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html
> > > >
> > > > Sorry if this question seems trivial, but I have been scratching my
> > > > head for a while now.
> > > >
> > > > thanks,
> > > > Peter
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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


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


Re: How to update a list from a checkbox in a loop in t5

Posted by Josh Canfield <jo...@thedailytube.com>.
The way checkbox works out of the box you need to coordinate with the
loop via the index or value parameter, as others have suggested. This
works but can be dangerous if your loop source happens to change
between the form render and the form submit. Try this extension so you
can bind a data value to the checkbox.

import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.corelib.components.Checkbox;
import org.apache.tapestry.ioc.annotations.Inject;

/**
 * <t:datacheckbox t:value="checked" t:data="data" />
 */
public class DataCheckbox extends Checkbox {

	@Parameter
	private String _data;
	
	@Inject
	private org.apache.tapestry.services.Request _request;
	protected void beforeRenderTemplate(MarkupWriter writer) {
		writer.attributes("value", _data);
	}
	
	@Override
	protected void processSubmission(String elementName) {
		super.processSubmission(elementName);
		String value = _request.getParameter(elementName);
		if ( value != null ) {
			_data = value;
		}
	}
}

You still have to provide the boolean value, but you can now also
provide a data parameter. While the boolean parameter will get set for
every instance of the checkbox, this extension only gets set if the
checkbox was checked.

I'd love to see the core checkbox component support more than boolean values...
Josh

On Thu, Apr 24, 2008 at 3:59 AM, Peter Stavrinides
<P....@albourne.com> wrote:
> Hi Nicholas
>
> This is simply boilerplate code:
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>      <t:checkbox t:id="archived" value="archive" />
> </t:loop>
>
>
> Archive is a read only boolean (no setter permitted), no model or encoder is available, which = no easy way to update like say if this was a textfield, making the checkbox not very useful in a loop!
>
> Peter
>
>
>
> ----- Original Message -----
> From: "nicholas Krul" <ni...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Thursday, 24 April, 2008 1:13:44 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
> Subject: Re: How to update a list from a checkbox in a loop in t5
>
> Perhaps some code would help us out.
>
> .tml loop & checkbox snippet
>
> .java index & getter & setter snippet
>
>
> ? I can only try
>
> On Thu, Apr 24, 2008 at 10:54 AM, Peter Stavrinides <
> p.stavrinides@albourne.com> wrote:
>
> > I have also noticed that the value parameter on the checkbox component is
> > a read only boolean, so using accessors to write the value is impossible,
> > which confirms the checkbox is not usable in this way in a loop.
> >
> >
> > Peter Stavrinides wrote:
> >
> > > Sorry, let me try rephrasing my question:
> > >
> > > When I click on the checkbox, how do I modify the corresponding object
> > > in the loop? The only way I can see of doing this is to iterate manually, in
> > > which case a Tapestry checkbox component is not usable in a loop.
> > >
> > > Peter
> > >
> > > Peter Stavrinides wrote:
> > >
> > > > Hi All
> > > >
> > > > I this scenario:
> > > > <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
> > > >           <t:checkbox t:id="archived" />
> > > > </t:loop>
> > > >
> > > > How do I use the checkbox correctly when the user clicks it? 'I want
> > > > to associate it with an object' via a primary key perhaps...but the checkbox
> > > > only seems to have a value property of the type boolean:
> > > >
> > > >
> > > > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html
> > > >
> > > > Sorry if this question seems trivial, but I have been scratching my
> > > > head for a while now.
> > > >
> > > > thanks,
> > > > Peter
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > > For additional commands, e-mail: users-help@tapestry.apache.org
> > > >
> > > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
--
TheDailyTube.com. Sign up and get the best new videos on the internet
delivered fresh to your inbox.

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


Re: How to update a list from a checkbox in a loop in t5

Posted by Peter Stavrinides <P....@albourne.com>.
Hi Nicholas

This is simply boilerplate code:
<t:loop source="myDOA" value="selectedDOA" encoder="encoder">
      <t:checkbox t:id="archived" value="archive" />
</t:loop>


Archive is a read only boolean (no setter permitted), no model or encoder is available, which = no easy way to update like say if this was a textfield, making the checkbox not very useful in a loop!

Peter


----- Original Message -----
From: "nicholas Krul" <ni...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, 24 April, 2008 1:13:44 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: How to update a list from a checkbox in a loop in t5

Perhaps some code would help us out.

.tml loop & checkbox snippet

.java index & getter & setter snippet


? I can only try

On Thu, Apr 24, 2008 at 10:54 AM, Peter Stavrinides <
p.stavrinides@albourne.com> wrote:

> I have also noticed that the value parameter on the checkbox component is
> a read only boolean, so using accessors to write the value is impossible,
> which confirms the checkbox is not usable in this way in a loop.
>
>
> Peter Stavrinides wrote:
>
> > Sorry, let me try rephrasing my question:
> >
> > When I click on the checkbox, how do I modify the corresponding object
> > in the loop? The only way I can see of doing this is to iterate manually, in
> > which case a Tapestry checkbox component is not usable in a loop.
> >
> > Peter
> >
> > Peter Stavrinides wrote:
> >
> > > Hi All
> > >
> > > I this scenario:
> > > <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
> > >           <t:checkbox t:id="archived" />
> > > </t:loop>
> > >
> > > How do I use the checkbox correctly when the user clicks it? 'I want
> > > to associate it with an object' via a primary key perhaps...but the checkbox
> > > only seems to have a value property of the type boolean:
> > >
> > >
> > > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html
> > >
> > > Sorry if this question seems trivial, but I have been scratching my
> > > head for a while now.
> > >
> > > thanks,
> > > Peter
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: How to update a list from a checkbox in a loop in t5

Posted by nicholas Krul <ni...@gmail.com>.
Perhaps some code would help us out.

.tml loop & checkbox snippet

.java index & getter & setter snippet


? I can only try

On Thu, Apr 24, 2008 at 10:54 AM, Peter Stavrinides <
p.stavrinides@albourne.com> wrote:

> I have also noticed that the value parameter on the checkbox component is
> a read only boolean, so using accessors to write the value is impossible,
> which confirms the checkbox is not usable in this way in a loop.
>
>
> Peter Stavrinides wrote:
>
> > Sorry, let me try rephrasing my question:
> >
> > When I click on the checkbox, how do I modify the corresponding object
> > in the loop? The only way I can see of doing this is to iterate manually, in
> > which case a Tapestry checkbox component is not usable in a loop.
> >
> > Peter
> >
> > Peter Stavrinides wrote:
> >
> > > Hi All
> > >
> > > I this scenario:
> > > <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
> > >           <t:checkbox t:id="archived" />
> > > </t:loop>
> > >
> > > How do I use the checkbox correctly when the user clicks it? 'I want
> > > to associate it with an object' via a primary key perhaps...but the checkbox
> > > only seems to have a value property of the type boolean:
> > >
> > >
> > > http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html
> > >
> > > Sorry if this question seems trivial, but I have been scratching my
> > > head for a while now.
> > >
> > > thanks,
> > > Peter
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > > For additional commands, e-mail: users-help@tapestry.apache.org
> > >
> > >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: How to update a list from a checkbox in a loop in t5

Posted by Peter Stavrinides <p....@albourne.com>.
I have also noticed that the value parameter on the checkbox component 
is a read only boolean, so using accessors to write the value is 
impossible, which confirms the checkbox is not usable in this way in a 
loop.

Peter Stavrinides wrote:
> Sorry, let me try rephrasing my question:
>
> When I click on the checkbox, how do I modify the corresponding object 
> in the loop? The only way I can see of doing this is to iterate 
> manually, in which case a Tapestry checkbox component is not usable in 
> a loop.
>
> Peter
>
> Peter Stavrinides wrote:
>> Hi All
>>
>> I this scenario:
>> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>>            <t:checkbox t:id="archived" />
>> </t:loop>
>>
>> How do I use the checkbox correctly when the user clicks it? 'I want 
>> to associate it with an object' via a primary key perhaps...but the 
>> checkbox only seems to have a value property of the type boolean:
>>
>> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html 
>>
>>
>> Sorry if this question seems trivial, but I have been scratching my 
>> head for a while now.
>>
>> thanks,
>> Peter
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>


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


Re: How to update a list from a checkbox in a loop in t5

Posted by Peter Stavrinides <p....@albourne.com>.
Sorry, let me try rephrasing my question:

When I click on the checkbox, how do I modify the corresponding object 
in the loop? The only way I can see of doing this is to iterate 
manually, in which case a Tapestry checkbox component is not usable in a 
loop.

Peter

Peter Stavrinides wrote:
> Hi All
>
> I this scenario:
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>            <t:checkbox t:id="archived" />
> </t:loop>
>
> How do I use the checkbox correctly when the user clicks it? 'I want 
> to associate it with an object' via a primary key perhaps...but the 
> checkbox only seems to have a value property of the type boolean:
>
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html 
>
>
> Sorry if this question seems trivial, but I have been scratching my 
> head for a while now.
>
> thanks,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

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


Re: How to update a list from a checkbox in a loop in t5

Posted by nicholas Krul <ni...@gmail.com>.
try adding an index to the loop, and then using this index to do the
translation b/n the getters/setters.

(but I don't know anything about encoders)

--nK

On Wed, Apr 23, 2008 at 3:24 PM, Peter Stavrinides <
p.stavrinides@albourne.com> wrote:

> Hi All
>
> I this scenario:
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>           <t:checkbox t:id="archived" />
> </t:loop>
>
> How do I use the checkbox correctly when the user clicks it? 'I want to
> associate it with an object' via a primary key perhaps...but the checkbox
> only seems to have a value property of the type boolean:
>
>
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html
>
> Sorry if this question seems trivial, but I have been scratching my head
> for a while now.
>
> thanks,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

Re: How to update a list from a checkbox in a loop in t5

Posted by Peter Stavrinides <P....@albourne.com>.
Hi Nicholas

An encoder is a fundamental Tapestry concept, used when you need to bind your implementation of a translator to a component, it has no effect in this example. The reason why it is not working is because the value property on the checkbox is limited to read only boolean (a getter accessor method). 

There is no other available property to use, so there is no way that I know of to bind to a listener/event and reference a corresponding object in the loop.

If anyone knows how, then please share! ...to me this appears to be essential functionality that is missing.

Peter

----- Original Message -----
From: "nicholas Krul" <ni...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, 24 April, 2008 3:48:46 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: How to update a list from a checkbox in a loop in t5

Perhaps trimming it back to the minimum might help... if it doesn't fix it,
it might help diagnosis.
I don't know why this isn't working.


1) remove the id attribute from the checkbox. T5 will generate one, and it
will be unique
2) remove the encoder. Just because _I_ don't understand it... and I don't
see why you need it.
     a) temporarilary remove any code in the loop that relies on the
encoder.

3) stack trace & more code

let us know.

--nK

On Thu, Apr 24, 2008 at 1:39 PM, Peter Stavrinides <
P.Stavrinides@albourne.com> wrote:

> Hi Ivan
>
> This is precisely what I tried.
>
>
> ----- Original Message -----
> From: "Ivan Dubrov" <wf...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Thursday, 24 April, 2008 1:59:10 PM GMT +02:00 Athens, Beirut,
> Bucharest, Istanbul
> Subject: Re: How to update a list from a checkbox in a loop in t5
>
> Peter Stavrinides wrote:
> > Hi All
> >
> > I this scenario:
> > <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
> >            <t:checkbox t:id="archived" />
> > </t:loop>
>
> Have you tried something like this:
> in .tml:
>
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>           <t:checkbox t:id="archived" t:value="archived" />
> </t:loop>
>
> in .java:
>
> public boolean isArchived() {
>  return selectedDOA.isArhived();
> }
>
> public void setArchived(boolean value) {
>  return selectedDOA.setArhived(value);
> }
>
> selectedDOA is your loop object.
>
> > How do I use the checkbox correctly when the user clicks it? 'I want
> > to associate it with an object' via a primary key perhaps...but the
> > checkbox only seems to have a value property of the type boolean:
> >
> >
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html
> >
> >
> > Sorry if this question seems trivial, but I have been scratching my
> > head for a while now.
> >
> > thanks,
> > Peter
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> WBR,
> Ivan S. Dubrov
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

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


Re: How to update a list from a checkbox in a loop in t5

Posted by nicholas Krul <ni...@gmail.com>.
Perhaps trimming it back to the minimum might help... if it doesn't fix it,
it might help diagnosis.
I don't know why this isn't working.


1) remove the id attribute from the checkbox. T5 will generate one, and it
will be unique
2) remove the encoder. Just because _I_ don't understand it... and I don't
see why you need it.
     a) temporarilary remove any code in the loop that relies on the
encoder.

3) stack trace & more code

let us know.

--nK

On Thu, Apr 24, 2008 at 1:39 PM, Peter Stavrinides <
P.Stavrinides@albourne.com> wrote:

> Hi Ivan
>
> This is precisely what I tried.
>
>
> ----- Original Message -----
> From: "Ivan Dubrov" <wf...@gmail.com>
> To: "Tapestry users" <us...@tapestry.apache.org>
> Sent: Thursday, 24 April, 2008 1:59:10 PM GMT +02:00 Athens, Beirut,
> Bucharest, Istanbul
> Subject: Re: How to update a list from a checkbox in a loop in t5
>
> Peter Stavrinides wrote:
> > Hi All
> >
> > I this scenario:
> > <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
> >            <t:checkbox t:id="archived" />
> > </t:loop>
>
> Have you tried something like this:
> in .tml:
>
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>           <t:checkbox t:id="archived" t:value="archived" />
> </t:loop>
>
> in .java:
>
> public boolean isArchived() {
>  return selectedDOA.isArhived();
> }
>
> public void setArchived(boolean value) {
>  return selectedDOA.setArhived(value);
> }
>
> selectedDOA is your loop object.
>
> > How do I use the checkbox correctly when the user clicks it? 'I want
> > to associate it with an object' via a primary key perhaps...but the
> > checkbox only seems to have a value property of the type boolean:
> >
> >
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html
> >
> >
> > Sorry if this question seems trivial, but I have been scratching my
> > head for a while now.
> >
> > thanks,
> > Peter
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> > For additional commands, e-mail: users-help@tapestry.apache.org
> >
> >
>
>
> --
> WBR,
> Ivan S. Dubrov
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>

RE: How to update a list from a checkbox in a loop in t5

Posted by Joel Wiegman <Jo...@dswinc.com>.
Peter,

Are you using a DefaultPrimaryKeyEncoder as your encoder?

Joel

-----Original Message-----
From: Peter Stavrinides [mailto:P.Stavrinides@albourne.com] 
Sent: Thursday, April 24, 2008 8:39 AM
To: Tapestry users
Subject: Re: How to update a list from a checkbox in a loop in t5

Hi Ivan

This is precisely what I tried.


----- Original Message -----
From: "Ivan Dubrov" <wf...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, 24 April, 2008 1:59:10 PM GMT +02:00 Athens, Beirut,
Bucharest, Istanbul
Subject: Re: How to update a list from a checkbox in a loop in t5

Peter Stavrinides wrote:
> Hi All
>
> I this scenario:
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>            <t:checkbox t:id="archived" /> </t:loop>

Have you tried something like this:
in .tml:

<t:loop source="myDOA" value="selectedDOA" encoder="encoder">
           <t:checkbox t:id="archived" t:value="archived" /> </t:loop>

in .java:

public boolean isArchived() {
  return selectedDOA.isArhived();
}

public void setArchived(boolean value) {
  return selectedDOA.setArhived(value);
}

selectedDOA is your loop object.

> How do I use the checkbox correctly when the user clicks it? 'I want 
> to associate it with an object' via a primary key perhaps...but the 
> checkbox only seems to have a value property of the type boolean:
>
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tape
> stry/corelib/components/Checkbox.html
>
>
> Sorry if this question seems trivial, but I have been scratching my 
> head for a while now.
>
> thanks,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


--
WBR,
Ivan S. Dubrov



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


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


Re: How to update a list from a checkbox in a loop in t5

Posted by Peter Stavrinides <P....@albourne.com>.
Hi Ivan

This is precisely what I tried.


----- Original Message -----
From: "Ivan Dubrov" <wf...@gmail.com>
To: "Tapestry users" <us...@tapestry.apache.org>
Sent: Thursday, 24 April, 2008 1:59:10 PM GMT +02:00 Athens, Beirut, Bucharest, Istanbul
Subject: Re: How to update a list from a checkbox in a loop in t5

Peter Stavrinides wrote:
> Hi All
>
> I this scenario:
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>            <t:checkbox t:id="archived" />
> </t:loop>

Have you tried something like this:
in .tml:

<t:loop source="myDOA" value="selectedDOA" encoder="encoder">
           <t:checkbox t:id="archived" t:value="archived" />
</t:loop>

in .java:

public boolean isArchived() {
  return selectedDOA.isArhived();
}

public void setArchived(boolean value) {
  return selectedDOA.setArhived(value);
}

selectedDOA is your loop object.

> How do I use the checkbox correctly when the user clicks it? 'I want 
> to associate it with an object' via a primary key perhaps...but the 
> checkbox only seems to have a value property of the type boolean:
>
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html 
>
>
> Sorry if this question seems trivial, but I have been scratching my 
> head for a while now.
>
> thanks,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
WBR,
Ivan S. Dubrov



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


Re: How to update a list from a checkbox in a loop in t5

Posted by Ivan Dubrov <wf...@gmail.com>.
Peter Stavrinides wrote:
> Hi All
>
> I this scenario:
> <t:loop source="myDOA" value="selectedDOA" encoder="encoder">
>            <t:checkbox t:id="archived" />
> </t:loop>

Have you tried something like this:
in .tml:

<t:loop source="myDOA" value="selectedDOA" encoder="encoder">
           <t:checkbox t:id="archived" t:value="archived" />
</t:loop>

in .java:

public boolean isArchived() {
  return selectedDOA.isArhived();
}

public void setArchived(boolean value) {
  return selectedDOA.setArhived(value);
}

selectedDOA is your loop object.

> How do I use the checkbox correctly when the user clicks it? 'I want 
> to associate it with an object' via a primary key perhaps...but the 
> checkbox only seems to have a value property of the type boolean:
>
> http://tapestry.apache.org/tapestry5/tapestry-core/ref/org/apache/tapestry/corelib/components/Checkbox.html 
>
>
> Sorry if this question seems trivial, but I have been scratching my 
> head for a while now.
>
> thanks,
> Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
WBR,
Ivan S. Dubrov