Displaying 20 results from an estimated 10000 matches similar to: "Removing values from a select (drop-down) box"
2008 May 02
1
names of select elements inside a fields_for block not generated as expected
Hey All,
I''m trying to play along w/the ''complex forms 1'' railscast
(http://railscasts.com/episodes/73) and having trouble. The view is
projects/new. I''m trying to add some project_people to the form w/code
like so:
<% form_for(@project) do |f| %>
[project stuff here]
<% for pp in @project.project_person %>
<% fields_for
2009 Sep 14
2
Set a select box with default value selected
I am relating to the book & subject example mentioned in the tutorial
mentioned here:
http://www.tutorialspoint.com/ruby-on-rails-2.1/rails-examples.htm
There is a file that goes like show_subjects.html.erb and it will list
all the books for that particular subject we''ve selected.
Suppose if there were no books to show for the subject we can ideally
show a corresponding message
2008 Oct 09
2
has_many validation the Rails way
Okay, this is something I run into a lot and don''t really have a great
solution. Here is a simple example:
class Blog < ActiveRecord::Base
has_many :posts
validates_presence_of :name
end
class Post < ActiveRecord::Base
belongs_to :blog
validates_presence_of :name
validates_presence_of :blog_id
end
Now, if I want to create a blog and post at the same time I
2009 Sep 24
8
Drop down list ?
Hi Gurus, I''m trying to tackle a drop down list. I have category and
item dbs, and they''re wired up with category has_many :items and item
belongs_to :category, and an item has a category_id. I have this code
in my new/edit.html.erb for item:
<%= f.collection_select :category_id,
Category.find_main, :id, :header, {}, :multiple => false %>
And a pretty drop down list
2010 Sep 08
4
Populate combo box from database without repeatness
Hi,
I have a column of data with repeated as mentioned below.
*column_name*
Acer
Lenova
HP
Lenova
Acer
Acer
Lenova
I need to populate this column in a combo box without repeated data as
mentioned below
*combo box*
Acer
Lenova
HP
I tried as
<%= collection_select(:column_name, TableName.all)%>
"table_names" is a table and "column_name" is a column needed to
2008 Jan 19
1
Decimals are being converted to Bigdecimals!!!!!
Hi all,
I''m working on a financial app, and have set up some columns in my
tables as decimals with precision => 8 and scale => 2. My migration
looks like:
change_column :lineitems, :price, :decimal, :precision =>
8, :scale => 2
change_column :payments, :amount, :decimal, :precision =>
8, :scale => 2
I''ve run the migration and restarted the server. I
2009 Jan 18
2
after_save -- stack level too deep
Hi all,
I''m running into a brick wall trying to figure out my problem here. I
have a model that has a boolean property called "paid". I''d like to
add the following to my model:
def after_save
self.amount == self.splits.sum(:amount) ? self.update_attribute
(:paid, true) : self.update_attribute(:paid, false)
end
The problem is, when I do this I get an error that
2006 Jul 16
2
HELP - Save drop down list using "collection_select"
Each post has a single category, which I''m filling a drop down list by
using this:
#view
<p><label for="post_type_id">Category</label><br />
<%= collection_select(:id, :type_id, Type.find(:all), :id, :category) %>
</p>
In my Post model I have a field called "type_id" which is to be filled
by the id in the Type table upon
2009 Feb 17
3
Dynamic select box
Hi everyone,
I have a problem. I want to display a different select box wether the
current user is an admin or an user.
So I thought I could do this in my view where my form is displayed :
<p class="form-input">
<%= f.label(:role_id, ''Role:'') %>
<%
if (current_user.admin?)
then collection_select(:user, :role_id, Role.find(:all, :order =>
2006 Apr 24
4
creating a select box
Hi
trying to create a select box in _form.rhtml.
I have a table called organisations that contains fileds, 2 being ''id''
and ''name''
these are the fields I need to bring over to the clients _form.rhtml.
whats the best way of going about that??
2 ways i have seen suggested that I cant get to work
-@organisations = Organisation.find_all placed this in def new
2007 Dec 15
3
List Box Issue - Should be easy, but nor for me!
I have the following snippet in my app:
<% @anitem = Item.find(:all, :conditions => "id = " + params[:id]) %>
<% form_for :anitem, :url => { :action => :updateitem } do |thisform|
-%>
...
... (some code...removed)
...
<%= collection_select :thisform, :item_category,
ItemCategory.find(:all), :id, :name %><br>
<%= collection_select :thisform,
2010 Aug 02
1
Drop down boxes from table data
Hi
I have another question for how best to do this. Now I have been
following the tutorial at:
http://www.tunaslut.com/learning-ruby-drop-down-lists-in-one-to-many-relationships,
however when I change the view over from
<% @cities.each do |city| %>
<tr>
<td><%=h city.city_name %></td>
<td><%=h city.country_id %></td>
to:
<%
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
2006 Jan 06
2
beginner: help using <select> drop down list
Hi, first time posting here. I''m in the process of learning ruby and the
rails framework and i''ve come to a road block. I started off by using
the Onlamp tutorial online and got a test database and all of the
generated scaffold pages. I am currently working on a drop down box
using the select tag. I figured out how to get values from a ''name''
column in my
2006 Apr 21
1
select box with multiple rows
I want a select box that displays 5 rows instead of one row and a drop down.
so i figure this should work, but it doesn''t.
<%= collection_select(:constellation, :region_id, @regions, :id, :name,
html_options = {:size => ''5''})%>
I am not quite sure how to use that html_options and googling around I didnt
find anything directly on point.
Any suggestions?
2010 Aug 03
3
Drop down box in ruby
Hello I''ve only been playing with ruby and rails for a few short weeks,
I have an class called time in my libs folder and I want to call an
array from this class and populate a drop down box/select box in rails
in one of my view pages.
everything online is so confusing regarding this..
Just say my array is like this
time = [[minute,min,20,50],[hour,hr,10,50]]
How would I get a select
2006 Apr 06
1
drop down menu - getting @params[:id] value.
I am looking to get my option drop down list to populate from a model.
In my controller i''m using:
@roles = Role.find(:all, :order => "name")
in my view I have:
<%= collection_select(:id, :name, @roles, :id, :name) %> role <%=
submit_tag("Go") %>
I cannot get just the id of the selected option. If i inspect the params
I get:
2008 May 29
6
Production install (RoR + Oracle + IIS)
Hi.
Although an expert developer for IBM systems (iSeries) I am VERY new
to RoR and somehow to the PC development world as well and not
familiar AT ALL with PC configurations, etc. (in my regular job good
ol'' IBM takes care of all that and I just need to code). So forgive me
if any of the following sounds stupid, it probably is. Just get a
laugh at my expense and try to answer between
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 Jan 03
1
prompting to choose an item from a select box
Hi:
Sad question, I know. I saw it somewhere but can''t rediscover it. I
have a collection_select and want to add a prompt so the dropdown
displays "select one"
How is that done?
thanks.
bruce