my code looks the same, except that for 'text' I use "Name" instead of
"ToString", "Name" being a property of the Customer.
$Form.Select("customer.Id", "$customers", "%{value='Id', text='Name',
firstoption='Select a customer'}")
but i think i've found the problem:
i was writing "$customers" instead of $customers
:| shoot me..
On Oct 1, 4:46 pm, "Diego Nascimento" <[EMAIL PROTECTED]>
wrote:
> i forgot to say, the ToString need to be a Attribute in your Customer class,
> i have never tried using methods.
>
> 2008/10/1 Diego Nascimento <[EMAIL PROTECTED]>
>
> > supose this:
>
> > Controller:
>
> > Customer[] customers = Customer.FindAll() // eg
>
> > PropertyBag["customers"] = customers;
>
> > Try this in the view:
>
> > $FormHelper.Select("customer.Id", $customers, "%{value='Id',
> > text='ToString'}")
>
> > /*
> > the "value" attribute indicate wich Attribute in the class customer will
> > fill the option values and the "text" attribute indicate wich Attribute in
> > the class customer will fill the option Text
> > */
>
> > in HTML it will be like this:
>
> > <select name="customer.Id" id="customer_Id">
> > <option value="1">Text 1</option>
> > <option value="2">Text 2</option>
> > ...
> > <option value="N">Text N</option>
> > </select>
>
> > 2008/10/1 bdaniel7 <[EMAIL PROTECTED]>
>
> >> Hello,
>
> >> I'm trying to create a select list with $FormHelper.Select.
> >> The PropertyBag["customers"] is filled with a Customer[].
> >> I have implemented Customer.ToString(), however the select is filled
> >> with as many Option items as the characters of the type name:
> >> C
> >> u
> >> s
> >> t
> >> o
> >> m
> >> e
> >> r[]
>
> >> What am i doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---