[prev in list] [next in list] [prev in thread] [next in thread] 

List:       rails
Subject:    [Rails] FormOptionsHelper select
From:       chero7 () telus ! net (James Earl)
Date:       2005-01-30 2:22:20
Message-ID: 200501291923.08198.chero7 () telus ! net
[Download RAW message or body]

Thank you for pointing me in the right direction.  That worked perfectly.

On January 29, 2005 5:43 pm, Francisco Hernandez wrote:
> use collection_select
>
> <%= collection_select("job", "client" , @clients, "id", "name") %>
>
> @clients holds a collection of Client objects, id ends up being the
> value and name ends up being the text displayed
>
> this would create:
>
> <select name="job[client]">
> <option value="1">Francisco Hernandez</option>
> <option value="2">James Earl</option>
> </select>
>
> James Earl wrote:
> > Hi,
> >
> > Would someone be able to give me a quick example using select(), or point
> > me to additional info?  I've been trying to figure it out for awhile now.
> >  I'm sure it's probably very easy and that I'm not in the right mindset.
> >
> > Originally I got stuck in this mindset that options = {} was for the
> > actual <option></option> tags!  :)  Finally I realized that's what the
> > 'choices' argument is for.
> >
> > What's the best way to take the results from:
> >
> > @places = Place.find_all
> >
> > and use it with select()?  I also can't seem to figure out how to get the
> > <option> to read <option value="id">value</option>.
> >
> > James
> >
> > _______________________________________________
> > Rails mailing list
> > Rails@lists.rubyonrails.org
> > http://lists.rubyonrails.org/mailman/listinfo/rails
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic