Displaying 20 results from an estimated 30000 matches similar to: "options_for_select helper is also mess...."
2006 Jan 23
2
problem with options_for_select
Hi All,
I am having a little difficulty using the options_for_select forms
helper method. I have a form for an active record object book, which
belongs to a publisher. Using the options_for_select is working fine
as far as creating the various options, but it will not output the
"selected=''selected''" bit of html needed to identify which publisher
is
2008 Jul 20
1
selected attribute in options_for_select
Hello Everyone
I have a select_tag which I populate using a map, I use
options_for_select method to pass the map and "selected" value. For some
reason I can not get the option "selected" based on the value I pass to
the selected attribute. Here is the code
<%= select_tag :current_course,
options_for_select( Course.find(:all).map {|p| [p.title,p.id]},
@selected )
2008 Jul 26
1
Dropdown selected value not reflecting in edit view
hi
I am facing the following issue:
I have the following dropdown, in the new view
select_tag "experience[]", options_for_select([[less_than_1_year,
[0,1]],[between_1_and_3_years, [1,3]],[between_3_and_5_years,
[3,5]],[between_5_and_7_years,[5,7]], [between_7_and_10_years,[7,10]],
[above_10_years,[10,50]]])
The selected value of the user is not getting reflected in the Edit view
of
2007 May 24
1
How do I show the selected values in options_for_select? Not as simple as it sounds.
How do I show the selected values in options_for_select? I have a
Service model and a AccessControl model. When a user edits a Service I
want the services access_controls to be pre-selected.
Models:
Service has_many AccessControls
AccessControl belongs_to Service
application.rb:
$types = Array["Athens", "htpasswd", "IP", "None", "Other",
2010 Dec 22
1
'No route matches' error with select_tag
Rails 3: I have a view books/:id/show.html.erb - in the view, I have a form
with a select tag to pick a template, that on dropdown should submit the
form which rerenders the page based on the selection:
<%= form_tag book_path(@book) do %>
>
> <%= select_tag "template[]",
>> options_for_select([["Template1","template1"], ["Template2",
2007 May 11
5
options_for_select - how to set the selected value?
Ok, this should be simple but I am finding it''s not and previous
postings don''t seem to shed too much light on this.
I have a select_tag with 4 values pulled in via a helper:
def filter_hours
filter_hours = [
["1 hour", 1],
["24 hours", 24],
["7 days", 168],
["14 days", 336],
]
end
The select_tag looks
2006 Jun 26
0
options_for_select-how to store cookie selected value ques.
#Controller
cookies[:state] = state
if state != nil and state.to_i != -1
conditions << ''stateid = ?''
cond_args << state
cookies[:state] = state
end
if !cookies[:state].blank?
@default_state = cookies[:state]
else
@default_state = ""
end
# view - html
2007 May 21
0
options_for_select and setting css class values
Hi,
i''m not sure if this is possible using erb (at the very least, I can''t
figure it out by googling or via searching this board), so here
goes...
i''m using erb to make a select box with several hundred <option>
values
it looks something like this:
<%= select_tag ''controls'', options_for_select(@controls.map {|cpd|
2006 Jul 04
1
options_for_select - default nil value
I have a field in a view, like so:
<%= select_tag(''quoted_condition'',
options_for_select([''NEW'',''RETAIL'',''OEM'',''REFURB''], ''NEW'')) %>
This sets the ''selected'' value to ''NEW'' - however, I would like to have
a nil value here, so I can
2010 Mar 24
0
Select_tag with options_for_select not populating DB.
I''m trying to get my animal app to let users populate info about each
animal. The code below partially works. It shows the drop down menu,
and it shows the names of what I wanted it to be the names of the
Databases. I don''t know how to make it work so it shows the name dog
and than you hit submit and it appears in the dog view. When I hit
submit it just makes a new view under the
2006 Jul 29
0
displaying select value and debugging RoR application
Folks,
I am running into the following problem.
I have a company model that has_many addresses and address belongs_to
company (it also belongs to a User model but I assume that is irrelevant to
this issue). I am in the list_companies view of the company_controller. When
the user selects a company from the drop down I dynamically update the
cities dropdown for the cities that the selected company
2008 Jan 03
1
Help using options_for_select in select_tag
<b>Client</b><br />
<%= select_tag ''clients[]'',
options_for_select(
[['' '',''1''], [''aaaa'',''2''],
2006 Jan 14
2
I think options_for_select is backwards
With a hash such as:
stuff = {''1''=>''desc 1'', ''2''=>''desc 2'', ''3''=>''desc 3''}
options_for_select(stuff) will output:
<option id="desc 1">1</option>
<option id="desc 2">2</option>
<option id="desc 3">3</option>
2008 Jan 22
1
getting multiple select to work: options_for_select
Hi,
<%= select_tag ''image_id'', options_for_select(Image.find(:all) {|
an_image| [ an_image.name, an_image.id ] }), :multiple => true %></p>
* I am in a view, and I am trying to search the image table and make a
multiple select box with each image''s name.
* Right now it is working, but I see this:
---------------------------------------------
2010 Jun 17
1
Problem with options_for_select
Hi,
I have a problem with the form select. In the value field I have the
generated html...
<%= f.select :brand_id,
options_for_select([[''Brands'', 0]] +
@search_brands.map { |b| [b.name, b.id]}),
{:id => ''cbxBrand'', :tabindex => (@tabindex += 1)} %>
This is the html:
<select name="search[brand_id]"
2006 Jan 01
7
Can''t get select helper to populate dropdown w/default value
Guys,
I searched this forum and found plenty of people having this problem,
but I didn''t see any definitive solution. Usings Rails 1.0.
When I edit an existing record, I can''t get the basic "select" helper to
display the current value contained in the field of the record. All of
my other (text) fields populate correctly with current field values.
There appears
2007 May 24
3
Help with Create and Update with options_for_select in a select_tag
I have a select_tag in my view that uses options_for_select with
multiple = true. I am having trouble figuring out the Rails way to
create and update that field. Please help.
Models:
-------------
Service has_many AccessControl
AccessControl belongs_to Service
application.rb
-------------------------
$types = Array["Athens", "htpasswd", "IP", "None",
2006 Jul 13
2
Simple dropdown menu
Hi, I''m quite new to this language and I''m having trouble finding out
simple things like a dropdown menu in rhtml. I know I have to use <%
select_tag %> but I''ve read lots of different ways to put in the options
so I''m a bit confused. Options are hard-coded for the menu I''m trying to
create so no database is involved!
Thanks v much!
Bex
--
2011 Jan 08
9
options_for_select.
Even reading the documentation I can not figure out what is the
select_tag difference between this:
<% = select_tag (bags [], "options_for_select (bags.collect @ {| bb |
[bb.bag_type, bb.id]},
ruser.bags.collect @ {| ub | ub.id}), {: multiple => true,: id =>
"bags"})%>
and this:
<% = select_tag "bags [], " options_for_select (bags.collect @ {| bb
2006 Apr 22
3
Creating a select dropdown box with links to methods
What would be the best way to create a form select dropdown box and upon
"submit" have it directly go to a controller method view?
I have something that somewhat works, but I think there is probably a
much easier way to do it. As of now, I have the dropdown list which
when the form is submitted is handed to a controller method which
basically
I have my dropdown box:
<%=