Displaying 20 results from an estimated 300 matches similar to: "collection_select question"
2005 Oct 26
1
Re: collection_select question about selected_value
Paul Welty wrote:
> collection_select(:client, :company_id, @companies, :id, :name, {
> :selected_value => 2 , :prompt => "Please select a company..." })
>
> Returns a functioning SELECT element, but it won¹t select the second item.
> (BTW, using the selected_value as a string doesn¹t work either)
>
> Am I doing something wrong, or is this impossible?
>
2006 Jan 11
6
How to display the error messages from the controller
I have a wizard which consists of two pages. To keep it simple let''s say
that the first page asks the user to select a state from the drop down menu.
In case the user doesn''t select any state, an error message needs to be
displayed.
Ideally I would like to do something like this.
def new
selected_value = params[:addevent][:state_id]
if selected_value == "-1"
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
2007 Jan 11
4
collection_select - how to set selected options?
In a form, I am trying to use collection_select with multiple=true, like
so:
collection_select(:user, :roles, Role.find(:all), ''id'', ''name'', {},
:multiple => true) %>
My multiple select box is rendered fine, but...
I want the select to have the current role options for the user
pre-selected when I view it. So if there are five roles in the database
and
2006 Sep 25
3
Subclasses - help required
Hello all and hoping for some insight
a project manger type of application, staff are assigned to projects,
but each staff has varied roles for different projects... STI does not
seem to be applicable here
Imagine a table staffs...
id int
name varchar
blah....
is_manager int 1
is_engineer int 1
is_producer int 1
and projects...
id
name
manager_id
engineer_id
producer_id
how is the best way
2006 Aug 17
1
2 newbie question
Hey all,
I have 2 newbie questions,
1st question:
<%= collection_select (:region, :id, @regionall, :id,
:title,options={:prompt=>"- Select cat -"}) %>
Ignores the :prompt part while options={:include_blank => true} works.
Any idea what I?m doing work with :prompt ?
2nd question:
How can make my collection_selected to display it''s third key by default?
I know it has
2008 Jun 08
1
Unable to get selected option with options_from_collection_for_select
I''m in Rails 2.1, Ruby 1.8.6 --
http://pastie.org/211063
<%= params[:doctor_id] %>
<%=
options_from_collection_for_select(Doctor.active, :id, :name, :selected
=> params[:doctor_id]) %>
<%=
options_from_collection_for_select(Doctor.active, :id, :name, :selected_value
=> params[:doctor_id]) %>
Returns:
53
<option value="49">Michael
2008 Aug 14
1
Moving Average Question
Dear all. I have data that looks like this:
Biller Cycle Jan Feb Mar Apr May JuneAB 1 100 150 150 200 300 450JL 2 650 600 750 700 850 800JL 3 700 740 680 690 700 580IR 1 455 400 405 410 505 550IR 4 600 650 700 750 650 680IR 5 100 150 120 130 140 190IR 9 600 640 630 625 680 690
For each biller and cycle, I want to determine the six
2008 Jul 22
2
Help with rearranging data
In Excel, I have data that looks like this.
Month
Seg
Prod
Biller
Cycle
Sales
1/1/2008
A
Table
Phyllis
1
500
1/1/2008
A
Table
Phyllis
2
600
1/1/2008
A
Table
Phyllis
3
650
1/1/2008
A
Table
Doreen
1
345
1/1/2008
A
Table
Doreen
2
451
1/1/2008
A
Table
Doreen
6
550
1/1/2008
A
Table
Doreen
9
590
1/1/2008
A
Table
Doreen
11
860
1/1/2008
A
Chair
Phyllis
1
300
1/1/2008
A
Chair
Phyllis
2
350
2006 Jun 07
1
Using DRb within Rails
I want to use DRb within my Rails app. Right now I''ve got a very basic class:
class PaymentGateway
cattr_accessor :ssl_config, :host, :port
def self.gateway
@@gateway ||= new
end
def process(amount, card, type = :auth)
@biller.process(amount, card, type)
end
def set_card(user_id, number)
@biller.set_card(user_id, number)
end
protected
def initialize
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/.
2006 Aug 13
0
selected_value or select not work
I''am try using collection_select helper, but the option selected_value
not work
i try like this:
<%= collection_select("user", "gender_id", @genders, "id",
"description", {:include_blank => true, :selected_value => "2"}
[]''s
Bruno
--
Posted via http://www.ruby-forum.com/.
2006 Jul 22
2
selected values in combo box
how to set default value in combo box or whether there is another way
plz explain with example code
advance thx
have a nice day
--
Posted via http://www.ruby-forum.com/.
2006 Mar 19
2
Functional Testing
Hey all,
I have a many-to-many relationship (Questions
has_and_belongs_to_many Answers), and when I destroy
the Question (the one) I also destroy all the Answers
(the many).
Since the following doesn''t seem to work for
has_and_belongs_to_many:
class Question < AR::Base...
has_and_belongs_to_many :answers, :dependent =>
:destroy
end
I have this embedded in a transaction block
2006 Jun 02
3
Advice, why value_before_type_cast in FormHelper?
I am wondering why is in creating text fields with form_helper used
value_before_type_cast instead of attribute value for field value?
I set rails enviroment so date fields are in european format
(dd.mm.yyyy) and would like to have same format in forms, but because of
value_before_type_cast is called, form fields are filled with
''yyyy-mm-dd'' or timestamp integer, etc.
2007 Jan 27
5
Prototype not processing javascript
I''m trying to change over from Rails 1.1.6 to 1.2.1 and have discovered
that either something is wrong with Prototype of else something has
changed that I am not aware of and cannot find documentation on. (I
just joined this group, so if this has already been cussed and
discussed here or in another list then please point me in the right
direction.)
I am trying to use the
2003 Jul 23
2
arpd question
Hi all,
I have noticed that the "CONFIG_NETLINK" has been removed since kernel
version 2.4.17, does this mean that we cannot use "arpd" with kernel
versions 2.4.17 onwards.
vishy
_______________________________________________
LARTC mailing list / LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/
2011 Oct 18
15
Generate model from database
hello i want to ask, how to generate model from table in my database.
That''s possibel ?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send
2006 Jul 27
9
Introspecting validates_presence_of
Hello people,
I''d like to detect whether an attribute of a model has
vaildates_presence_of applied to it so I can automatically apply a
mandatory (*) to the field...it doesn''t look easy...any ideas?
Cheers,
--
Dan Webb
http://www.danwebb.net
2006 Jul 02
0
Problem with select, options_from_collection_for_select for selected items
I''m having problems to make the selected works, i''ve been trying with select
and options_from_collection_for_select.
I''ve tried, :selected, :selected_key, :selected_value, and all i can got
from the doc page (
http://rubyonrails.org/api/classes/ActionView/Helpers/FormOptionsHelper.html#M000399
)
and from wiki.
Code:
select(''informacao'',