Displaying 20 results from an estimated 600 matches similar to: "retrieving values from combo box"
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 Apr 19
1
Query: how to group data by months from a text file
Dear R-users,
I have to deal with (txt) files of the form
10092007 24.62 24.31 24.90
11092007 19.20 23.17 22.10
13092007 24.71 27.33 23.10
14092007 27.33 27.90 24.10
15092007 28.22 28.55 24.30
16092007 28.53 29.24 27.40
17092007 24.19 30.64 26.80
18092007 22.60 20.62 28.40
19092007 18.89 21.70 14.70
20092007 21.27 22.92 17.30
21092007 22.38 24.72 18.80
22092007 23.94 24.73 20.40
23092007 25.33
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
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 Jan 09
7
Large select list, speed issues
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">I have a piece of code in my page
to generate
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 =
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
--
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 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
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 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:
<%= select
2010 Mar 22
7
How to reference a select_tag within a form
Hi All,
Inside my app\views\expenses\new.html.erb file, I had the code:
<% form_for(@expense) do |f| %>
[snip]
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<br />
<div id="vendor_droplist>
<%= select_tag "test",
options_for_select(@current_vendors.collect { |v|
v.nickname }),
{:multiple
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
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",
2013 Jan 18
2
options_from_collection_for_select
I have just started using RoR and am creating some select boxes on my form
with the following code:
<%= select_tag(options_from_collection_for_select(Owner.all, :id, :fname))
%>
My problem is that it does NOT return the first record from the table, but
just the second and succeeding records.
Does anyone have any ideas on how I can get the first record included in
the select box?
Thanks.
2008 Jul 31
2
selected value for options_from_collection_for_select
Hey,
I am trying to get a select list with a selected value in it. Even if I
put in an integer, like this,
<%= select_tag(fruit.id, "<option>No Contract</option>" +
options_from_collection_for_select(@fruit_types, "id", "kind", 3)) %>
the list still displays the first option (No Contract) in the list.
What am I doing wrong? I''ve looked
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
2010 Mar 20
4
Displaying an image in a Rails form_for
Hi,
I''ve got a public\images\DownArrow.jpg
and app\views\expenses\new.html.erb that want to present this image in
the following context:
<p>
<%= f.label :vendor %><br />
<%= f.text_field :vendor %>
<%= f.image "DownArrow.jpg" %>
<br>
<%= select_tag "test",
options_for_select(@current_vendors.collect {
2006 Apr 05
7
select_tag - populating options
Hello,
I want to a select tag, where you can choose a number between 1 and 100.
My inital code is based on the examples from Agile Web Development with
Rails, and looks like this:
view:
<%= options = [["Select number of lines", ""]] + RfqLines::LINE_QTY
select("rfq_line", "line_qty", options) %>
model:
LINE_QTY = select_fill
def