[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

misiek

2/24/2006 11:14:00 PM

I got for now this code html

<select name="visible">
<option value="1" selected="selected">Yes</option>
<option value="0">No</option>
</select> display

I need to transfer this code to ruby
some like =>

<%= select("property", "location_id",Location.find(:all, :conditions =>
"name != '' ").collect {|p| [p.name, p.id]}, { :include_blank => false }) %>

function above look for from database some data and put it into the drop
box fields
I need display only YES and NO and set them values 0 and 1

any ideas ?
3 Answers

Justin Collins

2/24/2006 11:24:00 PM

0

misiek wrote:
> I got for now this code html
>
> <select name="visible">
> <option value="1" selected="selected">Yes</option>
> <option value="0">No</option>
> </select> display
>
> I need to transfer this code to ruby
> some like =>
>
> <%= select("property", "location_id",Location.find(:all, :conditions
> => "name != '' ").collect {|p| [p.name, p.id]}, { :include_blank =>
> false }) %>
>
> function above look for from database some data and put it into the
> drop box fields
> I need display only YES and NO and set them values 0 and 1
>
> any ideas ?
>

Have you looked at erb
(http://ruby-doc.org/stdlib/libdoc/erb/rdoc/...) or the CGI
standard library (http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/...)?

Or do you mean parsing the HTML and making into that code?

-Justin


jgbailey

2/25/2006 12:10:00 AM

0

Go to http://api.rubyon... and click on the Method named
"collection_select". It does just what you want.

On 2/24/06, Justin Collins <collinsj@seattleu.edu> wrote:
>
> misiek wrote:
> > I got for now this code html
> >
> > <select name="visible">
> > <option value="1" selected="selected">Yes</option>
> > <option value="0">No</option>
> > </select> display
> >
> > I need to transfer this code to ruby
> > some like =>
> >
> > <%= select("property", "location_id",Location.find(:all, :conditions
> > => "name != '' ").collect {|p| [p.name, p.id]}, { :include_blank =>
> > false }) %>
> >
> > function above look for from database some data and put it into the
> > drop box fields
> > I need display only YES and NO and set them values 0 and 1
> >
> > any ideas ?
> >
>
> Have you looked at erb
> (http://ruby-doc.org/stdlib/libdoc/erb/rdoc/...) or the CGI
> standard library (http://ruby-doc.org/stdlib/libdoc/cgi/rdoc/...)?
>
> Or do you mean parsing the HTML and making into that code?
>
> -Justin
>
>

Stefan Lang

2/25/2006 6:07:00 AM

0

Why not use a check box? I always hated drop downs for binary state
variables.

_Kevin

On Saturday, February 25, 2006, at 8:18 AM, misiek wrote:

>I need display only YES and NO and set them values 0 and 1
>
>any ideas ?
>





--
Posted with http://De.... Sign up and save your time!