Hmm. You are right. I think  I managed to mix  PropertySelection (which is
easy to work with) and Select (which is not).  I actually switched from
Select to PropertySelection for a project just because it was such a pain to
get this right.

However, looking at the only surviving example online of Select, it's
apparent that it assumes an array of boolean, of which the ordering is
crucial, and that one can then "map" the order on another array or something
else ordered to get at what that selection means.

ref;
http://jakarta.apache.org/tapestry/tapestry/ComponentReference/Select.html

So I don't know if I can be of much more help, but It looks like you could
bend the example to you needs, just exchange the String[] that defines the
color to another array of your objects.

Cheers,
PS

On 3/10/06, Madan, Vishal (Home Office) <[EMAIL PROTECTED]> wrote:
>
> Behavior os select is such that ittries to update whatever is target
> "Selected ". In this case , it will try to update boolean value, which
> won't give us correct value after form submit
>
>
>
> -----Original Message-----
> From: Peter Svensson [mailto:[EMAIL PROTECTED]
> Sent: Friday, March 10, 2006 2:29 PM
> To: Tapestry users
> Subject: Re: Creating Form Components in loop
>
>
> But can't you just call another mehtod which peruse ageRange and
> produces a
> boolean, like;
> <option jwcid="@Option"
> selected="ognl:eventRegistrationUpdate.checkIt">
>
> And in the class;
>
> public boolean getCheckIt()
> {
>    boolean rv = false;
>    Object o = getAgeRange();
>    ...
>    ... check o (or whatever it is) an determine if you should return
> true or
> false
>    ...
>
>    return rv;
> }
>
>
> Cheers,
> PS
>
>
> On 3/10/06, Madan, Vishal (Home Office) <[EMAIL PROTECTED]> wrote:
> >
> > <option jwcid="@Option"
> > selected="ognl:eventRegistrationUpdate.ageRange"
> >
> > in this "selected" always expects boolean value. As the value
> > eventRegistrationUpdate.ageRange is not boolean , it is setting all
> > options as selected.
> >
> >
> >
> >
> > -----Original Message-----
> > From: Peter Svensson [mailto:[EMAIL PROTECTED]
> > Sent: Friday, March 10, 2006 1:35 PM
> > To: Tapestry users
> > Subject: Re: Creating Form Components in loop
> >
> >
> > But the problem is that it doesn't work. You do get an exception when
> > you
> > try to reach that page.
> >
> > Note that for each loop, the current object in the loop is set in the
> > value
> > argument to the For/ForEach component, which in your case is
> >
> > eventRegistrationUpdates.ageRange
> >
> > Which translates to
> >
> > getEventregistrationsUpdates().getAgeRange();
> >
> > Or set*, when the value is set.
> >
> > Hmm.  I think that what you really want to do is to have a separate
> > object
> > which is set each loop and contain the current
> 'EventRegistraionUpdate'
> > or
> > so.
> >
> > So if you change it to
> >
> > <span jwcid="@Foreach" source="ognl:application.ageRangeList"
> > value="ognl:eventRegistrationUpdate">
> >
> >
> > and add to you class
> >
> > public abstract Object getEventRegistrationUpdate();
> > public abstract void setEventRegistrationUpdate(Object o);
> >
> > Then you can use that in the option;
> >
> > <option jwcid="@Option"
> > selected="ognl:eventRegistrationUpdate.ageRange"
> > label="ognl:eventRegistrationUpdate.ageRange.description"/>
> >
> > ...
> >
> > ...
> >
> > Oh wait. Now I see.  You just have to cut out the last part of the
> value
> > in
> > the For statement, and you're done.
> >
> > Cheers,
> > PS
> >
> >
> >
> >
> > On 3/10/06, Madan, Vishal (Home Office) <[EMAIL PROTECTED]> wrote:
> > >
> > > You are correct. I tried with boolean first. But to show pre
> selection
> > > in select boxes , I have to pass paramter(ageRange). Other wise It
> has
> > > no way of showing pre selection
> > >
> > > -----Original Message-----
> > > From: Peter Svensson [mailto:[EMAIL PROTECTED]
> > > Sent: Friday, March 10, 2006 1:23 PM
> > > To: Tapestry users
> > > Subject: Re: Creating Form Components in loop
> > >
> > >
> > > This isn't really what I know, but I think that is is generally very
> > > tricky
> > > to pass parameters to a method referred to with ognl. In general I
> > just
> > > make
> > > a boolean method with no arguments whatever, and then just use
> > > getBinding("foo") or just getAgeRange() to set temporary variables
> in
> > > that
> > > method. It feel seasier, I think.
> > >
> > > Cheers,
> > > PS
> > >
> > > On 3/10/06, Madan, Vishal (Home Office) <[EMAIL PROTECTED]> wrote:
> > > >
> > > > Thanks for reply. I am able to show the pre selection using
> > > > <option selected =
> > > "ognl:isSelected(eventRegistrationUpdates.ageRange)">
> > > > But when I update the select box values and submit the form I get
> an
> > > > exception
> > > > Unable to ognl expression
> > > isSelected(eventRegistrationUpdates.ageRange)
> > > > to false
> > > >
> > > > -----Original Message-----
> > > > From: Peter Svensson [mailto:[EMAIL PROTECTED]
> > > > Sent: Friday, March 10, 2006 1:04 PM
> > > > To: Tapestry users
> > > > Subject: Re: Creating Form Components in loop
> > > >
> > > >
> > > > Hmm. What kind of error or faulty output do you get?
> > > >
> > > > I lack a Form component that wraps the whole thing. Maybe the @For
> > at
> > > > the
> > > > top should actually be a @Form of some sort.
> > > > Please look at the
> > > >
> > > > On 3/10/06, Madan, Vishal (Home Office) <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > I want to create form components( Select Boxes) in loop. My
> > problem
> > > is
> > > > > how do I display pre selected values in those select boxes.
> > > > > page does not know about those components as they are created on
> > the
> > > > run
> > > > > time and not defined in the
> > > > > .page specification.
> > > > >
> > > > >
> > > > >
> > > > > <span jwcid="@For" source="ognl:eventRegistrationUpdates"
> > > > > value="ognl:eventRegistrationUpdate">
> > > > >
> > > > > <select jwcid="[EMAIL PROTECTED]" id="ageRangeListID"
> > > > > tabindex="140">
> > > > >
> > > > > <option value="">-- Select --</option>
> > > > >
> > > > > <span jwcid="@Foreach" source="ognl:application.ageRangeList"
> > > > > value="ognl:eventRegistrationUpdates.ageRange">
> > > > >
> > > > > <option jwcid="@Option"
> > > > > selected="ognl: eventRegistrationUpdates.ageRange"
> > > > > label="ognl:eventRegistrationUpdates.ageRange.description"/>
> > > > >
> > > > > </span>
> > > > >
> > > > > </select>
> > > > > </span>
> > > > > eventRegistrationUpdates is a object that I loop through. Now I
> > have
> > > > to
> > > > > display pre selected values in every select box ( value from
> > > > > eventRegistrationUpdates object)
> > > > >
> > > > >
> > > > >
> > >
> ______________________________________________________________________
> > > > > This e-mail has been scanned by The Leukemia & Lymphoma Society
> > > > Managed
> > > > > Email Content Service, provided by MCI and Message Labs.
> > > > >
> > > > > NOTICE: This message, including all attachments transmitted with
> > it,
> > > > is
> > > > > for the use of the addressee only. It may contain proprietary,
> > > > confidential
> > > > > and/or legally privileged information. No confidentiality or
> > > privilege
> > > > is
> > > > > waived or lost by any mistransmission. If you are not the
> intended
> > > > > recipient, you must not, directly or indirectly, use, disclose,
> > > > distribute,
> > > > > print or copy any part of this message. If you believe you have
> > > > received
> > > > > this message in error, please delete it and all copies of it
> from
> > > your
> > > > > system and notify the sender immediately by reply e-mail. Thank
> > you.
> > > > >
> > > > >
> > > > >
> > > > >
> > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail:
> > [EMAIL PROTECTED]
> > > > > For additional commands, e-mail:
> > > [EMAIL PROTECTED]
> > > > >
> > > > >
> > > >
> > > >
> > ______________________________________________________________________
> > > > This e-mail has been scanned by The Leukemia & Lymphoma Society
> > > Managed
> > > > Email Content Service, provided by MCI and Message Labs.
> > > >
> > > > NOTICE: This message, including all attachments transmitted with
> it,
> > > is
> > > > for the use of the addressee only. It may contain proprietary,
> > > confidential
> > > > and/or legally privileged information. No confidentiality or
> > privilege
> > > is
> > > > waived or lost by any mistransmission. If you are not the intended
> > > > recipient, you must not, directly or indirectly, use, disclose,
> > > distribute,
> > > > print or copy any part of this message. If you believe you have
> > > received
> > > > this message in error, please delete it and all copies of it from
> > your
> > > > system and notify the sender immediately by reply e-mail. Thank
> you.
> > > >
> > > >
> > > >
> > > >
> > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> > > > For additional commands, e-mail:
> > [EMAIL PROTECTED]
> > > >
> > > >
> > >
> > >
> ______________________________________________________________________
> > > This e-mail has been scanned by The Leukemia & Lymphoma Society
> > Managed
> > > Email Content Service, provided by MCI and Message Labs.
> > >
> > > NOTICE: This message, including all attachments transmitted with it,
> > is
> > > for the use of the addressee only. It may contain proprietary,
> > confidential
> > > and/or legally privileged information. No confidentiality or
> privilege
> > is
> > > waived or lost by any mistransmission. If you are not the intended
> > > recipient, you must not, directly or indirectly, use, disclose,
> > distribute,
> > > print or copy any part of this message. If you believe you have
> > received
> > > this message in error, please delete it and all copies of it from
> your
> > > system and notify the sender immediately by reply e-mail. Thank you.
> > >
> > >
> > >
> > >
> ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > >
> > >
> >
> > ______________________________________________________________________
> > This e-mail has been scanned by The Leukemia & Lymphoma Society
> Managed
> > Email Content Service, provided by MCI and Message Labs.
> >
> > NOTICE: This message, including all attachments transmitted with it,
> is
> > for the use of the addressee only. It may contain proprietary,
> confidential
> > and/or legally privileged information. No confidentiality or privilege
> is
> > waived or lost by any mistransmission. If you are not the intended
> > recipient, you must not, directly or indirectly, use, disclose,
> distribute,
> > print or copy any part of this message. If you believe you have
> received
> > this message in error, please delete it and all copies of it from your
> > system and notify the sender immediately by reply e-mail. Thank you.
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> ______________________________________________________________________
> This e-mail has been scanned by The Leukemia & Lymphoma Society Managed
> Email Content Service, provided by MCI and Message Labs.
>
> NOTICE: This message, including all attachments transmitted with it, is
> for the use of the addressee only. It may contain proprietary, confidential
> and/or legally privileged information. No confidentiality or privilege is
> waived or lost by any mistransmission. If you are not the intended
> recipient, you must not, directly or indirectly, use, disclose, distribute,
> print or copy any part of this message. If you believe you have received
> this message in error, please delete it and all copies of it from your
> system and notify the sender immediately by reply e-mail. Thank you.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to