similar to: select_tag - populating options

Displaying 20 results from an estimated 1100 matches similar to: "select_tag - populating options"

2006 Apr 06
3
Inserting parent_id
I have two tables: - projects - lines lines has a foreign key constraint to projects.id When I''m creating a new line object, the database fails on insert with the following error: "PGError: ERROR: null value in column "project_id" violates not-null constraint" My code looks like this: def create_lines @project = params[:id] @line =
2006 Apr 11
5
multiple select_tag
Hello again, I have a table called line_items, with the following fields: id int item_name varchar() qty int conditions text I''ve made my LineItem model, and everything works as such (with simple text_fields).. Now I''d like for the conditions field to be a select_tag() with multiple choice possibility. I''m guessing I need some code to expand/restract the array for
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 Jun 13
7
ActiveRecord attribute= overload
I want to overload the = operator for one of the attributes in a model to run a filter on the input. However I can''t do this: def attribute=(data) self.attribute = filter(data) end because that creates an infinite recursive loop. How do I get around this? -- Posted via http://www.ruby-forum.com/.
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",
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
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 select whichever string in the drop-down list matches
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"
2006 Apr 01
0
select_tag problem
Hi I have a feeds db described like this: | id | int(11) | NO | PRI | | auto_increment | | url | varchar(255) | YES | | | | | name | varchar(255) | YES | | | | | type | varchar(255) | YES | | | | | valid | int(11) | YES | | | | In my feeds view i have :
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 working example? -- Posted via http://www.ruby-forum.com/.
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 (it submits to the same page). The
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 },
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. ...
2006 Jan 19
2
select vs. select_tag
I have a "Users" object and a "Timesheets" object. Each timesheet entry belongs to a User, which is selected from a drop-down list. The timesheet has a user_id field. (The user needs to have an option to select a different user due to the way our system works.) If i use the "select" object, which is bound to the Timesheet model, using this code: &lt;%= select
2006 Jun 24
1
select or select_tag ?
hello PPL, I''ve seen now that the _form.rhtml generated by script/scaffold is populated by <%= 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
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''],
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,
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",