Displaying 20 results from an estimated 10000 matches similar to: "drop down"
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 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 Jul 31
1
Stuck on options_from_collection_for_select
Hi everyone,
I''m stuck on something that seems to be super easy, but maybe I''m just
too tired to see the obvious answer.
I''m trying to make a drop down with select_tag and
options_from_collection_for_select. I''m trying to fill this drop down
list with different human races (white, black, hispanic, etc. in the
database under the name field, with a unique id
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
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.
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
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
2011 Aug 29
7
:onchange in rails 3
Hi,
Anybody know why :onchange works here...
<%= select_tag "Minisections",
options_from_collection_for_select(@minisections, :id, :title, :selected
=> @minisection.id), {:onChange => "{alert(''Minisection has been changed
to x !'')}"} %>
but NOT here (to call a function)...
<script type="text/javascript">
function xyz() {
2006 Mar 30
3
Rails 1.1, Markaby, options_from_collection
Last night, I upgraded one of my rails apps to 1.1. This app uses
Markaby exclusively for its'' views, and once I checked out the latest
revisiong of Markaby (r33), everything was working fine except for one
thing:
select_tag(''province_id'', options_from_collection_for_select(@provinces,
"id", "name"))
Now returns this (as you see it is spitting
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",
2007 Nov 08
3
options_from_collection_for_select
I need to add a blank or dashed field to the
options_from_collection_for_select helper but can''t seem to get it to
work. Tried this, but with no effect:
<%= options_from_collection_for_select @airlines, ''id'', ''name''],
{:include_blank=>true} %>
Anyone know how to do this? Thanks,
-S
--
Posted via http://www.ruby-forum.com/.
2008 Apr 10
3
option_groups_from_collection_for_select with a ActiveRecord::Base single object
Rails documentation gives examples of using
option_groups_from_collection_for_select with two tables/objects.
How could it be done with one?
Example that almost works:
I have a form to enter address from both the United States and Canada.
It has the following:
====new.html.erb====
<%= select_tag(
:state,
option_groups_from_collection_for_select(
State.countries,
:country,
2008 Apr 02
4
options_from_collection_for_select
I have a drop down of country''s and I would like the USA to be the first
displayed. I have tried:
<select id = "user_w_country" name ="user[w_country]" onchange =
"<%=func%>">
<%= options_from_collection_for_select @country, ''id'',
''country'', :selected =>
2006 Aug 07
2
Select Box Question
Hi,
Yet another newbie here... I''m writing an appliction in Rails, and I''ve
Ajaxified my select boxes so they update dynamically. I used the
"observe_field" method to monitor changes to my select box. I find that
it''s kind of erratic... it updates constantly and makes the selection
for me, based on where my mouse happens to be hovering when it does its
2006 Jul 26
4
Dropdown with concatenated columns.
What is the best way to create a drop down where the viewable text in a
concatenation of 2 or more columns?
For instance, I hane a lookup table with these columns.
Model FOO
columns: id , name, phone
In my drop select tag, I''d like the user to see:
"name1 phone1"
"name2 phone2"
etc..
I know I can do this using find_by_sql . ..
But, isn''t there a more
2006 May 22
15
collection_select default selected value
Hiall,
Unfortunately I just can''t find out how to setup a default selected
value when using collection_select. My call is like so:
<%= collection_select(:consultant, :lastname, @consultants, :id,
:lastname, { :selected => @current_consultant.id } ) %>
which is not working, I debugged so far that I know that
@current_consultant.id contains the correct value.
Any tips?
cheers
2008 May 07
2
Begginer question: how to edit using options_from_collection
Hi,
I have been stuck on this problem for 2 hours and still have no idea how
to do it. Basically I have a relationship between Workout and Exercise
Exercise has many Work out
anyway in my code at Workout.view the edit.html that was generated
through scaffold I wrote this
<% form_for(@workout) do |f| %>
<p>
<b>Exercise</b><br />
<%= select_tag
2006 Apr 26
3
drop downs
I''m having trouble getting a second drop down populated based on the
value from the first drop down. I''ve tried following some of the
examples posted, but haven''t had any success. I''m new to RoR so any help
would be appreciated. When the first drop down''s value gets changed, it
calls the correct method in the controller and even finds the correct
2008 Jul 14
1
Limit the data displayed in the index view with a select box
Hello,
Please be prepared for some very basic, very newbie, very
HTML-beginner, knows-nothing-about-AJAX questions...
I have a (RESTful, if it makes any difference) application that
displays a ton of data (names of documents) on the index page.
I would like to limit the amount of data displayed, by adding a SELECT
box that narrows the list of data down by selecting a category.
Each category has
2005 Dec 21
3
How to make a drop-down automatically submit an AJAX form
Hi,
I know that to make a dropdown box automatically submit when you change
the value, you do this:
<select ..... onchange="this.form.submit();">
BUT i''ve got an ajax form, and if i do the above trick, it simply
reloads the ajax partial into the whole screen, rather than into the div
where it is meant to go.
I''ve already got it all working so that if you click