Displaying 20 results from an estimated 131 matches for "select_tag".
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 30
1
Parameters for FormOptionsHelper select vs. FormTagHelper select_tag
I must be missing something when it comes to the parameter differences
between form FormOptionsHelper select and FormTagHelper select_tag.
Code that follows, works perfectly -
<%= f.select :unit, units_to_select(@product), :size=>"20"%>
The following code, does not. The helper function never even seems to
be called.
<%= select_tag "unit", units_to_select(@product) %>
Why would this be the case?...
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 like the following:
select_tag :order_hours, options_...
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 `select_tag'' for #<ActionView::Helpers::FormBuilder:
0...
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_se...
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, logic would dictate
something like:...
2006 Jan 09
7
Large select list, speed issues
...head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">I have a piece of code in my page
to generate a drop-down listing all of the company''s projects in
alphabetical order.<br>
<br>
<%= select_tag
name=''project_name'',options_from_collection_for_select(Project.find(:all,
:conditions => "status not containing ''dead''", :order =>
''project_name''), "id", "project_name") %><br>
<br>
When my page...
2006 Oct 25
1
Help with a select_tag; getting an undefined method `stringify_keys' error
Hi,
I''m trying to use a select_tag in the following manner:
<%= select_tag(:received_at, @select_dates, String(params[:received_at]) ) %>
But I get this error:
undefined method `stringify_keys'' for "":String
Removing the third parameter eliminates the error, but I was hoping
that the drop-down list will...
2007 Jan 25
2
React on select_tag (onchange)
...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.
...
<%= select_tag("rowsperpage", options_for_select( [[5, 5], [10,10],
[25,25], [50,50], [100,100],[200, 200],[500, 500],[1000, 1000]],
@rowsperpage ),
:onchange=>"alert(this.form.rowsperpage.options[this.form.rowsperpage.selectedIndex].value)"
) %>
...
The alert was only an example (I tes...
2006 Jan 19
2
select vs. select_tag
...e Timesheet model,
using this code:
<%= select ''timesheet'', ''user_id'', User.find_all.collect {|p|
[p.username, p.id]} %>
Then the list defaults to the first option. I''d like it to default to
the logged in user though. I can do this using select_tag with
options_from_collection_for_select without a problem, but then I lose
the functionality of having the field linked to the table. If i use a
select_tag, I''m forced to add additional code in the Create method to
get the user_id into the new record (which just doesn''t seem to fo...
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 selec...
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 => na...
2006 Apr 01
0
select_tag problem
...;', ''url'' %></p>
<p><label for="feed_name">Name</label><br/>
<%= text_field ''feed'', ''name'' %></p>
<p><label for="feed_type">Type</label><br/>
<%= select_tag ''feed[type]'', options_for_select( { "Option1" => "opt1",
"Option2" => "opt" }) %>
<!--[eoform:feed]-->
----
If the data is sent .save and update_attributes doesn''t save the type
field even though it''s sent...
2006 Apr 19
2
select_tag and :include_blank => true not working
Guys,
I''m using select_tag to display a non-model dropdown, which works fine.
However, I''ve tried every which way to use the :include_blank => true
option, but it simply won''t display a blank value. Using :include_blank
=> true with select on model fields works fine.
Can someone please show me a...
2005 Nov 22
3
non model select_tag problem
What am I doing wrong here:
select_tag(''website_ids[]'',
options_from_collection_for_select(Website.find_all, ''id'', ''name'',
params[:website_ids]), {:multiple => true, :size => 5})
It works fine except that it does not display the selected options once
the form is submitted (...
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
--
Posted via http://www.ruby-forum.com/.
2006 Feb 02
8
How to get all selected rows in the mutli-selection listbox?
Hi,
I have created a multiple selection listbox with
rails, when I try to get the rows selected by user,
rails send back only the first one, how can I get the
other selected rows????
I created the listbox with the following function:
select_tag("form__list1",
options_for_select(["A","B","C","D"], selected = "A"),
html_options = {"size" => 5, "multiple" => true})
What I get from params is :
!map:HashWithIndifferentAccess
commit: Next
action: index
cont...
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[...
2006 Jun 24
1
select or select_tag ?
...;%= text_field ''model'', ''field'' %> without _tag!
but only text_field_tag is to be found in the 1.1.2 documentation..
(like in the rest of Module ActionView::Helpers::FormTagHelper there
is _tag)
I''ve tried to use <%= select instead of <% select_tag and it works
AND the first one generates:
<select id="tesi_relatore_id" name="tesi[relatore_id]">
and the other
<select id="tesi_controrelatore_id" name="tesi_controrelatore_id">
my class can be saved just using the first one. but now I'...
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''],
[''daemon'',''3''],[''nortel'',''4''],[''telefonica'','...