Displaying 20 results from an estimated 3000 matches similar to: "collection_select validation problem"
2012 Feb 15
1
Passing date as parameter while retrieving data from database using dbGetQuery
Hi All,
This might be simple question, I need to retrive data for modelling from the
databases. Eveytime date values changes so I countnot fix date value in the
code, it is required to pass as parameter.
When I pass the date as parameter, it throws error.
(ERROR: column "start_dt" does not exist Position: 285)
My script is as below, please guide me where am I going wrong?
All parameters
2006 Mar 07
6
how to add onchange javascript event to select field
I would like to add javascript ''onChange'' event handling for a select
field, such as
<%= collection_select("job", "client_id" , @clients, "id", "name") %>
with onChange="xxx"
Anyone know how to make this work?
Thank you,
Scott
--
Posted via http://www.ruby-forum.com/.
2006 Feb 10
2
How do I test actionview helpers in the console?
I would like to see the output of actionview helper methods, to be able
to play with it.
When I do the following in the console:
collection_select("job", "client_id" , @clients, "id", "name")
I get:
NoMethodError: undefined method `collection_select'' for
#<Object:0xb7cf1970>
I''d like to get something like:
<select
2006 Jan 25
2
select list generated from table
Have 2 tables - clients & case_managers
class Client < ActiveRecord::Base
has_one :case_manager
end
app/views/clients/_form.html contains line...
<p><% collection_select("client", "case_manager_id", \
case_manager.find_all, "name", "id") %></p>
and this line generates error...
undefined local variable or method
2006 Jan 03
4
validates_presence_of *_id attributes
Hi all,
I am a newbie to Rails. Please enlighten me on how to do this
appropriately, the Rails and the Ruby way:
Suppose I have a Recipe model. Let''s simplify things and pretend that
it has only 2 attributes, a :name and the other is a ''category_id''. In
the recipes table, category_id is a foreign key to field id of table
categories.
We also assume that I have generate
2006 Jan 03
6
Am I going too far or Rails is just confusing? was {validates_presence_of *_id attributes}
Thanks for the input Blair Zajac and Chris (Nolan and Hall), and for others.
If all of you have time, please follow this (the question still
relates to the previous posts by me):
I have provided full steps to reproduce the symptoms.
If it matters, I''m running Ruby 1.8.2, Rails 1.0, and MySQL 5.0.15 on
Windows XP Professional.
1. First, the setup
MySQL
-----
create database testdb;
2005 Jun 13
3
validations not working with collection population droplists
I have an ADD form with foreign key field values selectable via select
list ( collection_select (...)).
When I add validates_presence_of :someotherfield to my model for error
trapping, I get the following error for each droplist:
NoMethodError in Reviews#create_curriculum
Showing /reviews/_form.rhtml where line #16 raised:
undefined method `inject'' for nil:NilClass
Extracted source
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
2005 Jan 25
4
Collection_select with multiple options
Hi,
I have built a select field that allows multiple options selected with
collection_select and "multiple"=>"multiple". How do I go about
receiving the values? If I use a variable name like collection[], it
complains that I can''t use @collection[] as the instance variable.
TIA
victor
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
2006 Jul 16
6
using collection_select
hello,
supposing i have a User class that contains a Wibble
class User < ActiveRecord::Base
has_one :wibble
end
in my view i have
<%= collection_select :user, :wibble, Wibble.find(:all), :id, :name %>
when i post, i get an error like
"Wibble expected, got String"
how/where am I supposed to convert this posted wibble_id into a
Wibble, or am I using collection_select
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
2012 Sep 13
3
Creating a link_to from a collection_select
I want to be able to change one attribute of a link_to to be what is the
current selection of the collection_select. And needless to say I can''t
quite figure it out.
app/views/tasks/show.html.erb
Who would you like to assign this task to?<br />
<%= link_to ''Myself'', :controller => ''task_queues'', :task_id => @task.id,
:action =>
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 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 Nov 28
2
collection_select and selected_value
Hi,
I am using collection_select to build a drop down list. I would like
to have the current value selected. How can I do that?
My current code is straight from the example in Pragmatic Programmers
book [2nd ed, p480] copying here for reference.
<%=
@users = User.find(:all, :order => "name" )
form.collection_select(:name, @users, :id, :name)
%>
I went through the api docs
2006 Aug 16
1
how to update a collection_select from another
I have two collection_select in my list.rhtml:
<%= collection_select (:region, :id, @regionall, :id,
:title,html_options={:onChange => "new
Ajax.Updater(''related_provinces'',''/categories/related_provinces/" +
"?id=''+this[this.selectedIndex].value,
{asynchronous:true, evalScripts:true});"}) %><br>
<%= render :partial =>
2005 Jan 21
2
collection_select
I''m trying to use collection_select, but it''s not working as I expect. The
list populates correctly but the current value is not selected.
@question contains a topic (via topic_id), and @topics is the list of all
topics. Here''s my attempt to create a drop-down list of the topics.
form("question") do | form |
form << content_tag("b",
2010 Aug 30
1
update form text_field on collection_select selection
I have form and a collection_select control. I would like to update
form fields (text box) when I select an item from the collection_select
box.
It''s like selecting template from the collection_select and the template
automatically loads to text boxes.
Any help?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
2011 Oct 10
2
Collection_select
Hi,
I''m new using RoR and I have a ... trouble with
f.collection.select
What I have in a table is ... for example
group code
GroupA 07A
GroupA 08A
GroupA 10B
GroupB 06A
GroupB 11B
GroupB 07B
GroupC 10A
GroupC 09A
GroupC 09B
when I use
<%= f.collection_select :grupo, Equipo.find(:all), :id, :name, prompt:
''Choose a Group'' %>