Displaying 7 results from an estimated 7 matches similar to: "Rails 1.1, Markaby, options_from_collection"
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 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
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?
>
2010 Jun 17
1
Problem with options_for_select
Hi,
I have a problem with the form select. In the value field I have the
generated html...
<%= f.select :brand_id,
options_for_select([[''Brands'', 0]] +
@search_brands.map { |b| [b.name, b.id]}),
{:id => ''cbxBrand'', :tabindex => (@tabindex += 1)} %>
This is the html:
<select name="search[brand_id]"
2010 Sep 17
1
option_groups_from_collection_for_select
Hi,
in my development environment (Ruby 1.87, Rails 2.3.8) the following
code works fine:
<%= select "applicant", "member_1",
option_groups_from_collection_for_select(@topics, :members, :topic, :id,
:name, @applicant.member_1), {:include_blank => true} %>
Producing:
<optgroup label="Clinical Neuroscience">
<option value="1">Prof
2007 Nov 07
5
Unexplainable failure...at least for me
I have an address model with country_id and province_id fields
There is also a full_address method that returns an address that is in a
format that the google maps api will be able to return a long-lat
coords.
Within the full_address method there is a call to obtain the
province/state and country name.
---------
def full_address
...
full_address = [city, self.province.name,
2006 Mar 20
3
Linking two HTML SELECT''s together
Hi,
How do I link two HTML SELECT''s together. Let''s say for example that I
have a drop-down list with a list of all countries. Once the user
selects one of the countries I would like to make an AJAX call back to
the server to populate the second drop-down list with all of the cities
for that country.
Any ideas on how to go about to do this?
Regards
Jerrie Pelser
--