similar to: Make a checkbox checked based on a condition?

Displaying 20 results from an estimated 900 matches similar to: "Make a checkbox checked based on a condition?"

2006 Oct 15
2
Getting check_box to default to checked?
I''ve tried this (in a new method/template -- so @type doesn''t actually exist yet): check_box ''type'', ''notify_on_create'', {:checked=>''true''} But :checked seems to get swallowed. I''ve also tried setting notify_on_create to true in the Type model, but that doesn''t work either. Any way to get the
2006 Apr 26
8
Newbie: Hide div I''ve just show using link_to_remote?
I''m using link_to_remote to show details for an item that''s clicked. I''d like to hide the div with the next click, or alternatively have a "Hide" link within my div. What is the best way to accomplish this? Here''s my existing code: <% for task in @mytasks %> <div class="rowFormat"> <%= link_to_remote(
2006 Dec 03
1
Ugly code
I have a Product related to sizes by way of has_and_belongs_to_many. Currently in my product form partial, I have this really ugly (although functional) code. Note the hanging ">" that closes the "<input>". <p><label for="sizes">Sizes</label><br/> <% for size in @sizes %> <input type="checkbox"
2006 Mar 22
4
Newbie - populating select list from db
Can''t seem to find an example of this anywhere - how do I populate a select list in a form from a database? I have a form to create a new task. The task is for a client, so there should be a select list populated from my clients table. I thought this would work: <%= select ''task'', ''client_id'', Client.find_all, "id", "name"
2006 May 18
2
Newbie: Looking for a good starting reference
So I finally got everything up and running, and I''ve seen some "magical" stuff in tutorials bragging how easy and wonderful Rails is (and I believe it, for the most part). What I need now is a reference, a site or a book, that respects that I know a thing or two about app development and programming, but not necessarily anything about models, classes and controllers. I
2009 Apr 18
3
Create CheckBox
Hai, I want to create a checkbox the values are table field values. In my controller @emptypes = Emptypes.find(:all) In View <% @emptypes.each do |c| %> #Write checkbox generating code here <%= check_box("contacts",emptypes.types)%> <%end%> Anyknows please suggest me how to create a checkbox (values are retrived from table). -with Thanking&Regards
2006 Apr 24
12
pass checked boxes to controller
Noobie question here. :) I have a form with check boxes on them. I simply want the user to check the appropriate boxes, click the action (Add Visits). It''s my understanding, that these check box values go into a hash (add_visit_for_this_Pt), but I can''t seem to get this hash back to my controller for processing. Below is my form. Basically, all the controller is
2012 Sep 08
4
dash symbol
In the example below, what is the dash doing between the class attribute and array: (field_helpers - [:label, :check_box, :radio_button, :fields_for, :hidden_field, :file_field]).each do |selector| -- 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
2006 Feb 25
1
checkbox helper question
I used scaffolding, then modified. As an after thought I added a "boolean" checkbox to my database, form with this tag <p> <%= check_box ''is_hot_item'', @photo.is_hot_item %> <label for="is_hot_item">hot item?</label><br> </p> I check it and save. But I don''t get 1 saved in my database field. :( I have just the
2008 May 29
5
f.checkbox?
Okay so I have a typical search page where a keyword is entered and results are retrieved that match the keyword. What I want to do now is have checkboxes to search for results in specific areas (my site is a big events calendar with "streams" and "audiences") I want to use the checkboxes to look for results in ''streams'', ''audiences'', or
2005 Dec 27
2
Rewriting FormBuilder
Hi, I want to extend formbuilder to make it output a lable (I know about labeled_form_helper made by technoweenie), my own formating, and a couple of extra tags inside the form attribute. I was easily able to extend form_remote_to. But when I continue to adjust the way elements are handled I don''t know how to continue. I can''t find the method text_field thats should is
2006 May 11
3
multiple checkbox values, convert to string, 1 db field
Basically what I''m trying to do is create a way for users to enter "keywords" that will then be searchable. I.e., when a user creates a new Item, there is also a keywords field in the database that is a string like "purple triangle free" -- but all the user sees when they are creating the keywords is a series of checkboxes like: __blue __red __purple __circle
2006 Apr 22
0
Newbie - list based on joined query?
I''m retrieving a list of tasks to display in a page using @delegatedtask_pages, @delegatedtasks = paginate :tasks, :conditions => "user_id = " + session[:user_id].to_s + " percent_complete <> 100", :order_by => ''due_on asc'' I''d like to only list the tasks which have been assigned to other people. I have a table called
2006 Jun 07
5
check_box:how to update 2 checkboxes dependent on each other
I''ve got the following problem, I''ve created two check_boxes in my view. The user has to select one check_box, but isn''t allowed to seth both of them together on true. Now i am looking for functionality that can help me doing the folling: Scenario 1 CheckBox1 = True, The user sets CheckBox2 from False to True, now CheckBox1 should automatically become False.
2010 Nov 23
5
ActiveRecord not getting true value from checkbox
I have a checkbox tag as follows: <%= f.check_box :receive_offers %> When I view source in the html, I see the value of the checkbox is "1", with the normal hidden field value of "0". However, after posting the form and saving to the database, the Mysql column, which is a TinyInt, is ALWAYS 0. I''ve tried it with true/false values instead, and no luck. Any
2006 Jul 03
9
checkboxes
in the mean time i am using a checkbox like this : <input type="checkbox" name="var[car]" <%= var.car ? ''checked'' : '''' unless @var == nil %> /> but i am sure there is something better than this in rails like <%= checkbox_tag ''var'', ''car'', :checked => true %> but this is not
2007 Sep 15
3
check_box_tag always checked
#check_box and #check_box_tag are going to be the end of me. Why is this always checked? <% checked = @reservation.selected ? ''checked'' : nil %> <td><%= check_box_tag("reservation[" + @reservation.id.to_s + "][selected]", ''checked'', :checked => checked) %></td>
2006 Jan 21
5
How do you deal with non-model property form values
I have a User ActiveRecord model that has email and password properties. I want to build a login for that has a "remember me" option. My view looks like this: <% @page_title = "Login" -%> <%= error_messages_for ''user'' %> <%= form_tag %> <table> <tr> <td align="right" width="1%"
2006 Aug 09
2
How do you define a method
Hi all, I was wondering if anybody could help me figure why a view cannot find a method that I defined in another class. I do this in the view: (let''s say index.rhtml) <%= check_box("item_search_page", "method_name") Here, item_search_page is a variable in the view''s controller, which creates a new ItemSearchPage object. And I defined
2006 Apr 08
2
ActionView::Helpers::FormHelper instance methods should take an object reference rather than an object_name.
Hi ActionView::Helpers::FormHelper methods (e.g. #text_field, #check_box...) take object_name as an argument. From this argument they infer a name that is supposed to contains the reference to the relevant object. I can''t see why the FormHelper methods were designed that way. Compared to simply passing them a reference, the current way seems too complicated and an invitation to problems