Displaying 20 results from an estimated 3000 matches similar to: "dropdown list"
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
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
--
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",
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 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 )
2007 Jan 25
2
React on select_tag (onchange)
Hi,
I''m new in developint rails (but I love rails).
I would like to react on changing a field in the view (no model field)
from a selection box to show the number of rows (which I used in the
controller).
In the controller I read the params-hash:
...
@rowsperpage = params[''rowsperpage''].to_i
...
In the view I have the field, where I like to react directly.
...
2008 Apr 05
2
model select and non-model select_tag
Hello everyone, I''m just trying to understand some logical reasons
behind Rails syntax of "select" and "select_tag".
I know I can do this:
<%= form.select :card_type, supported_card_types,
{ :prompt => "Please Select..."} %>
which sets a model field in the params hash.
If I want to do the same for a non-model field,
2006 Mar 05
1
Storing a Selected Option in DB
OK, thanks to Kelly I got my options_for_select in a select_tag
helper method to use a Ruby range as a value. Now when the user makes
a selection from that list, I can''t figure out why the result doesn''t
get stored in the database.
The line in the _form looks like this:
<%= select_tag(:month, options_for_select((0..12).to_a)) %>
Pops up an option menu.
2005 Dec 21
1
Are Ducks Hibernating ?
Dears,
Remembering last value in a select box don''t work for me as :
Controller :
@years=(1970..2005).to_a
Form:
<%= select_tag "year", options_for_select( (2001..2005).to_a,
@params[:year] ) %>
I had to write
<%= select_tag "year", options_for_select( (2001..2005).to_a,
@params[:year].to_i ) %>
for it works.
Not important, but I''m
2008 Dec 02
1
form_for with partial using do |@f|
Is it possible to pass this FormBuilder object to a controller and then
back to a partial?
I have a form rendering a partial that i would like to update with a
call to my controller based on user selectable parameters, but when the
AJAX comes back, i get this error message because i cannot pass a form
builder object between the controller and the view:
"undefined method
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
2008 Sep 02
1
seledted option for select_tag
Hi iam using select_tag i want selected_option. i have made select
_tag like this
<%=select_tag(''name'', options_for_select({ :Relevance
=>''Relevant'',:Date=>''Recent''}),:selected=>params[:name].to_s) %>
The generated html look like this
<select selected="Relevant" name="name"
2009 Apr 12
3
Multi-button form
It cannot be this difficult, especially in rails. Here is my form code
in a partial for the index action of a controller:
<% form_tag({:controller => controller_name, :action => ''index''},
{:method => :get, :class => ''form''}) do %>
<div class="columns">
<div class="column left">
<p>
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",
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 Jun 28
6
select_tag
in my controller
@cursos = Curso.find_all
in my view i''m trying to do a select_tag with the results @cursos, using
a helper
select_tag "name" options_for_select(@cursos) --------> not works
select_tag "name" @cursos --------> not works
how to do it, using the helper?
tks
--
Posted via http://www.ruby-forum.com/.
2008 May 08
0
On 'Back' button of browser, drop down doesn't get refreshed
Hey guys,
i have a drop down in my UI, which value gets filled by session[:sale].
<%= select_tag :sale_id, options_for_select([["Select Sale", "0"]] +
@sales.collect { |s| [s.name, s.name] }, selected = session[:saleid]), {
:id => "sale_id", :onchange => "search_verify();" } %>
I have a post on, ''onchange'' event of it. if i
2008 Apr 24
2
select_tag and link_to
Does ROR allow passing the chosen value from a drop down using
select_tag into link_to ?
Basically I want to do something like:
<%= select_tag( "name", options_for_select(%w{John Doe Jane })) %>
<%= link_to "Delete",
{ :controller => "myname", :action => "add",
:id => name },
2009 Mar 11
1
NoMethodError for select_tag
Hello there. I am following a tutorial with rails 2.1 and I have come
across a problem where
<%= f.label :artist_id %><br />
<%= f.select_tag(:artist_id, options_for_select([[''choose one'',
'''']] + @artists.collect {|art| [art.name, art.id]}, @album.artist_id))
%> (Old artist info:<%= @album.artist_old%>)
gives
undefined method
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''],