You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Mite <mi...@gmail.com> on 2010/08/11 02:30:04 UTC
Select in Loop
Hi
I have the following loop containing two select components.
<form t:type="form" id="form1">
<p>
<table>
<tr t:type="loop" t:source="selectedMatches" t:value="currentSelected"
formState="none">
<td>${currentSelected.date}</td>
<td>${currentSelected.time}</td>
<td>${currentSelected.host}</td>
<td>${currentSelected.hScore}</td>
<td>-</td>
<td>${currentSelected.vScore}</td>
<td>${currentSelected.visitor}</td>
<td>${currentSelected.minute}</td>
<td>${currentSelected.league}</td>
<td><t:select t:id="betTypes" clientId="${currentSelected.id}"
model="betTypes" value="currentBetType"
labelField="${currentBetType}" onChange="this.form.submit();"/>
</td>
<td><t:select t:id="availableBets" model="availableBets"
value="currentAvailableBet"
labelField="${currentAvailableBet}"
onChange="this.form.submit();"/>
</td>
</tr>
</table>
</p>
</form>
All the selects get the value from the last select, something which I don't
want. I need them to all have their own independent values.
Is there any way to make this happen?
Thank you
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Select-in-Loop-tp2471420p2471420.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Select in Loop
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Tue, 10 Aug 2010 21:30:04 -0300, Mite <mi...@gmail.com> wrote:
> Hi
Hi!
> I have the following loop containing two select components.
I guess you need to provide a ValueEncoder to the Loop's encoder parameter.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Select in Loop
Posted by "Thiago H. de Paula Figueiredo" <th...@gmail.com>.
On Fri, 13 Aug 2010 09:16:08 -0300, Inge Solvoll <in...@gmail.com>
wrote:
> You have hit one of my problem spots in T5 :)
>
> I also just use formState="iteration", because I simply don't understand
> how to make the alternatives work...
Quick answer: it makes the form store information about the objects being
iterated, so it restores them when handling the form submission.
--
Thiago H. de Paula Figueiredo
Independent Java, Apache Tapestry 5 and Hibernate consultant, developer,
and instructor
Owner, Ars Machina Tecnologia da Informação Ltda.
http://www.arsmachina.com.br
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Select in Loop
Posted by Inge Solvoll <in...@gmail.com>.
You have hit one of my problem spots in T5 :)
I also just use formState="iteration", because I simply don't understand how
to make the alternatives work...
On Fri, Aug 13, 2010 at 1:40 PM, Mite <mi...@gmail.com> wrote:
>
> I made a ValueEncoder and also put formState="iteration" in the loop. The
> second one seemed to made it work, even though I don't really understand
> why.
>
> <tr t:type="loop" t:source="selectedMatches" t:value="currentSelected"
> formState="iteration" t:encoder="encoder">
> --
> View this message in context:
> http://tapestry.1045711.n5.nabble.com/Select-in-Loop-tp2471420p2572247.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: Select in Loop
Posted by Mite <mi...@gmail.com>.
I made a ValueEncoder and also put formState="iteration" in the loop. The
second one seemed to made it work, even though I don't really understand
why.
<tr t:type="loop" t:source="selectedMatches" t:value="currentSelected"
formState="iteration" t:encoder="encoder">
--
View this message in context: http://tapestry.1045711.n5.nabble.com/Select-in-Loop-tp2471420p2572247.html
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: Select in Loop
Posted by Pablo dos Reis <pa...@gmail.com>.
Mite,
You must use a property of your source as select value.
2010/8/11 Josh Canfield <jo...@gmail.com>
> Are you saying that when you post the form you are getting the last value
> from the form stored in the currentBetType and currentAvailableBet
> properties?
>
> With loops you have to remember that you only have one property in the page
> so it gets set repeatedly when you post the form. You can collect the values
> in a list in the property setter. If you search the list you should find
> several examples.
>
> -- Josh
>
> On Aug 10, 2010, at 5:30 PM, Mite <mi...@gmail.com> wrote:
>
> >
> > Hi
> >
> > I have the following loop containing two select components.
> >
> > <form t:type="form" id="form1">
> > <p>
> > <table>
> > <tr t:type="loop" t:source="selectedMatches" t:value="currentSelected"
> > formState="none">
> > <td>${currentSelected.date}</td>
> > <td>${currentSelected.time}</td>
> > <td>${currentSelected.host}</td>
> > <td>${currentSelected.hScore}</td>
> > <td>-</td>
> > <td>${currentSelected.vScore}</td>
> > <td>${currentSelected.visitor}</td>
> > <td>${currentSelected.minute}</td>
> > <td>${currentSelected.league}</td>
> >
> > <td><t:select t:id="betTypes" clientId="${currentSelected.id}"
> > model="betTypes" value="currentBetType"
> > labelField="${currentBetType}"
> onChange="this.form.submit();"/>
> > </td>
> > <td><t:select t:id="availableBets" model="availableBets"
> > value="currentAvailableBet"
> >
> labelField="${currentAvailableBet}"
> > onChange="this.form.submit();"/>
> > </td>
> > </tr>
> > </table>
> > </p>
> > </form>
> >
> > All the selects get the value from the last select, something which I
> don't
> > want. I need them to all have their own independent values.
> >
> > Is there any way to make this happen?
> >
> > Thank you
> >
> > --
> > View this message in context:
> http://tapestry.1045711.n5.nabble.com/Select-in-Loop-tp2471420p2471420.html
> > Sent from the Tapestry - User mailing list archive at Nabble.com.
> >
> > ---------------------------------------------------------------------
> > 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
>
>
--
Pablo Henrique dos Reis
Re: Select in Loop
Posted by Josh Canfield <jo...@gmail.com>.
Are you saying that when you post the form you are getting the last value from the form stored in the currentBetType and currentAvailableBet properties?
With loops you have to remember that you only have one property in the page so it gets set repeatedly when you post the form. You can collect the values in a list in the property setter. If you search the list you should find several examples.
-- Josh
On Aug 10, 2010, at 5:30 PM, Mite <mi...@gmail.com> wrote:
>
> Hi
>
> I have the following loop containing two select components.
>
> <form t:type="form" id="form1">
> <p>
> <table>
> <tr t:type="loop" t:source="selectedMatches" t:value="currentSelected"
> formState="none">
> <td>${currentSelected.date}</td>
> <td>${currentSelected.time}</td>
> <td>${currentSelected.host}</td>
> <td>${currentSelected.hScore}</td>
> <td>-</td>
> <td>${currentSelected.vScore}</td>
> <td>${currentSelected.visitor}</td>
> <td>${currentSelected.minute}</td>
> <td>${currentSelected.league}</td>
>
> <td><t:select t:id="betTypes" clientId="${currentSelected.id}"
> model="betTypes" value="currentBetType"
> labelField="${currentBetType}" onChange="this.form.submit();"/>
> </td>
> <td><t:select t:id="availableBets" model="availableBets"
> value="currentAvailableBet"
> labelField="${currentAvailableBet}"
> onChange="this.form.submit();"/>
> </td>
> </tr>
> </table>
> </p>
> </form>
>
> All the selects get the value from the last select, something which I don't
> want. I need them to all have their own independent values.
>
> Is there any way to make this happen?
>
> Thank you
>
> --
> View this message in context: http://tapestry.1045711.n5.nabble.com/Select-in-Loop-tp2471420p2471420.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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