Displaying 20 results from an estimated 4000 matches similar to: "prompting to choose an item from a select box"
2013 Jun 18
1
How to Pass Jquery selected dropdown values and radio button values to controller
Hi,
I have an advance search page and its code is as follows -
I have written my code like this
<div class="container">
<%= form_tag search_index_path, method: :get do %>
<%= radio_button_tag ''user_type'', ''customer'' %><p>Customer</p>
<%= radio_button_tag ''user_type'',
2005 Dec 20
1
How do I persist a value in a collection_select
Hi:
I am using a collection_select to select which client''s records I
want. Everything works properly EXCEPT the list box reverts to its
initial value rather than holding onto the client whose records I am
now viewing.
?
2009 Jan 15
2
collection_select not selecting default value
Hi,
I''m trying to create a dropdown using collection_select. However, I cant
seem to get it to select the right option by default.
In my controller I have a setup like this:
@content = Content.new
@content.selection_id = 3
@selections = Selection.find(:all)
In my view I have:
<% form_for :content, @content, :url => { :action => ''create'' } do |f|
%>
2006 Aug 17
3
Use collection_select
I use the following code in my view:
<%= collection_select(''datedata'', ''date'', @allDate, :id, :date) %>
It''s show me the date of all entries in the database (Dropdown menu).
Additional, I wrote a helper method "showDate" in the
application_helper.rb! How can I use this method in the
collection_select for every date entry?
thanks
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
2006 Apr 25
1
simple collection_select problem.
Hi,
I can do this :
collection_select "state", :id, TrainingState.find_all,:id,:name
but not this :
collection_select "state[]", :id, TrainingState.find_all,:id,:name
Anyone any idea why? Is there something about collection_select that
does not allow collections?
Thanks
Chris
--
Posted via http://www.ruby-forum.com/.
2006 May 26
4
What association do I want here, has_ or belongs_to?
I thought I had a handle on this one but it''s causing me grief and I''m
hoping somebody can set me straight. I have an object AlertTemplate
which will contain a fill in the blank style hunk of web content. I
then have an object, Alert, which will have a relationship to one of
those AlertTemplate objects, plus some data.
So, in human speak, I''d think that an Alert
2006 Mar 22
3
Parent-Child Tables Help
can someone help me with this
i have a table
cars
(
id int
model_id int
make_id int
color_id int
description text
constraint fk_cars_carmake foreign key(make_id) references
carmakes(id),
constraint fk_cars_carmodel foreign key(model_id) references
carmodels(id),
constraint fk_cars_color foreign key(color_id) references colors(id)
)
carmakes
(
id int
carmake varchar
)
carmodels
(
id
2006 Mar 22
1
HABTM / Dropdown Help Needed
I''m terribly new to Rails, so bear with me.
I have an application I am working on which deals with projects and
subcontractors. There can be several subs on each project and each sub
can work on several projects. I have my join table set up and
has_and_belongs_to_many in both models. If I manually put data in the
join table, this works in my show view:
<% for subcontractor in
2010 Feb 10
2
undefined method 'state'
I can''t imagine what I''m trying to do is complicated at all in Rails.
Yet, I am now getting this error: undefined method `state'' for
:StudentFailState:Symbol.
student.rb
has_one :student_fail
attr_accessor :student_fail_attribute
#controller
def student_fail
@student = @student.find params[:id]
def update_student_fail
@student.build_student_fail
2006 Jan 29
16
counting rows via associations
Hi:
I have a table called clients and each client has many lists (a
has_many and belongs_to has been created in the class.
What I need to do is get a count of the rows in each list for each
client. I was hoping I could do something like
client.lists.count but it does not seem to work. Any suggestions?
bruce
2008 Sep 08
1
ActiveRecord::StatementInvalid Error
Hi There,
I''m gettings the following errors while accessing my application.
Can someone please tell what is the possible cause and can it
be resolved.
"
ActiveRecord::StatementInvalid in Site#showalladdress
Showing site/showalladdress.rhtml where line #3 raised:
Mysql::Error: #42000You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version
2006 Nov 29
5
Collection_select with two columns and a prompt
Hello,
I am quite a newbie to RoR, I hope you maybe able to help.
I have a collection_select in a _form.rhtml:
"collection_select(:assets, :model_id, @models, :id,
:model_ref,options={:prompt => ''- Select a model -''})"
As you see my drop down menu will show the model_ref column.
1) Is it possible to have more than one column. For example I would
like to
2006 Apr 27
3
collection_select to display 2 fields
I''m trying to get a collection_select generated Drop-down box to display
two fields from a table (first name & last name); however, I am having
trouble concatenating the symbols. It appears as though any code I put
in the 5th argument for collection_select is processed prior to
executing the collection_select method. The code executes successfully
with 1 symbol in the 5th
2009 Oct 06
1
Problems Processing multiple form elements generated by javascript actions
Hi all,
After many days of struggling, I have a multi-model form with ajax
elements more or less working, but I''m hitting a wall with a few bugs
that I can''t figure out. Guidance would be very much appreciated.
I''m using the Ryan Bates technique from Advanced Rails recipes to
dynamically add and remove elements on a multi-model form.
2005 Dec 31
6
I don''t even know how to ask the question (4 lines of code)
I create a hash using this line of code @x = Account.find(:all)
I then want to go through each element in turn and add a key value
pair to the end of it. I thought this would work, but it does not.
@x.each do |a|
a.merge({"balance"=>50}
I used merge because I thought ''a'' would be a hash (how do you find
out the type of an object?)
I then guess it was
2009 Aug 11
5
Dynamic drop-downs in a form_for using AJAX remote_function - Help
Hello -
I am fairly new to Ruby on Rails, but feel like I am learning quick.
I have what seems to be a fairly unique issue as I cannot find much
out there that describes what I''m seeing. Hopefully it''s a very
simple fix, and I simply can''t see the forest through all the trees!
I am attempting to create 2 related drop-down lists in the same
form_for, both using
2005 Dec 15
3
Rails: Select and html forms
I''m close to getting this to work, but not quite there. I''m trying to
implement a dropdown control, with the current choice selected.
I have the following code in the view:
5 <select id="product_product_type" name="product[product_type]">
6 <%=
7 types = ProductType.find(:all, :order => "product_type")
8
2007 Aug 03
2
Does collection_select work in list.rhtml?
Hi,
I have 2 models:
Model 1: er, Columns: <er_id, er_name>
Model 2: er_process, Columns: <er_id, er_process_name>
er_id is a foreign key for Model 2.
When I am creating a new er_process or editing an existing one, I have
been successful to use collection_select to show the available er''s so
that the user can select a particular er by its name (to populate the
er_id
2006 Jun 22
2
Setting an index on a collection_select
I am creating a data entry form that allows a user to fill in multiple rows
and save them all at once. In my controller, I create an array of "person"
objects and pass it to the page. On the page, I have a text field like so:
<%= text_field "person", "name", "index" => 1 %>
Note the "index" attribute, which sets the name and id