similar to: Overridding readonly attribute in custom form builder

Displaying 20 results from an estimated 11000 matches similar to: "Overridding readonly attribute in custom form builder"

2006 Apr 23
3
custom form builder
In the API docs I found this: "You can also build forms using a customized FormBuilder class. Subclass FormBuilder and override or define some more helpers, then use your custom builder " I couldn''t find any further documentation on this. Where can I read more about this formbuilder class? For starters, where would I define a subclass of this class? TIA, Jeroen --
2008 Dec 02
1
form_for with partial using do |@f|
Is it possible to pass this FormBuilder object to a controller and then back to a partial? I have a form rendering a partial that i would like to update with a call to my controller based on user selectable parameters, but when the AJAX comes back, i get this error message because i cannot pass a form builder object between the controller and the view: "undefined method
2010 Jun 23
3
Custom default form builder in Rails 3
Hello everyone, I am trying to set a default custom form builder. I have defined my form builder class in "lib/mymodule/mybuilder.rb" as: module Mymodule class Mybuilder < ActionView::Helpers::FormBuilder ...... end end Then I am trying to use this custom class in application.rb as config.action_view.default_form_builder = Mymodule::Mybuilder. But I get "Uninitialized
2007 Dec 09
0
Writing Specifications for Custom Form Builders (and Helpers)
Hello all, Long time reader, first time poster! I am a relative newcomer (no idea what on earth I am doing) to Ruby, Rails and Rspec and have a feeling I am probably trying to run before I know how to walk. I had imagined a cool way of outputting a div around some form stuff which would have a class on it if the related field had errors, something a bit like: <%
2009 Feb 05
1
[rspec] [rails] Specing a form builder
I''m trying to set up and run a new form builder under rails, which lives under the helpers directory, but isn''t really a helper. (Not a module, so doesn''t mix in well) Short of dropping down into a view spec, how do I set up to actually spec the form builder? describe RandomFormBuilder do attr_reader :builder before do @object = mock_model(Foo) @builder =
2010 May 28
8
form helpers don't seem to work with RJS files...
I’ve been spending a great deal of time chasing this problem. Hopefully someone sees something obvious I’m doing wrong. Basically anytime I try to call fields_for from an RJS file or within a partial in the RJS file, I get the following error. My goal is simply to load a partial into a div. The fields in this partial require fields_for though. And that’s where the problem lies.
2006 Jan 13
0
Form element that is not an AR object attribute
Fellow Railers, I don''t know how to handle this kind of situation the Rails way, please help. DB ---- create table products (id int not null auto_increment, name varchar(255), primary key (id)); create table batches (id int not null auto_increment, product_id int not null, quantity int not null, price decimal(10,2) not null, primary key (id), foreign key (product_id) references
2013 Apr 10
1
Per form field_error_proc
Hi everybody, I needed change field error rendering for some forms created with Rail''s form builder. I found solution by changing ActionView::Base::field_error_ proc to own before form and changing it back after form rendered. I don''t like this solution :) It''s not thread-safe (but it''s not so important, nobody really wants it :), but I don''t like
2007 Sep 30
2
Outputing to the browser, how?
Hello, I''m writting some helper methods to write forms, so I have this working code: class TableFormBuilder < ActionView::Helpers::FormBuilder ["file_field", "password_field", "text_field"].each do |name| define_method(name) do |label, *args| @template.content_tag(:tr, @template.content_tag(:td, @template.content_tag(:label,
2008 Dec 07
0
boolean button helper
I don''t have a blog, but wanted to share this little bit of code with other semi-beginners like myself who are still learning to take advantage of rails features. Selecting an attribute with a boolean switch is a common pattern in forms. You can do it with a check box, but radio buttons are more expressive in some situations and better convey to the user that they are making a mandatory
2007 Apr 09
4
How do i switch off error wrapping for a specific field?
Hi, i have some issues with the default rails error wrapping. It wraps errors in a div with class ''fieldsWithError'', which is not good practice in my eyes. Adding a class ''error'' to the field would be much nicer. My solution to the problem: build your own FormBuilder. Funny enough, i found no (nice) possibility to switch error wrapping off while using the
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
2008 Mar 03
1
How change text_area form helper into rich text entry area/control?
Do you know how to render a rich text input area (with HTML formatting buttons (bold, italics, etc., available?) In RoR I''m hoping this is very easy to pull off?!? <%= text_area ''blogentry'', ''entry'' %></p> TO <%= rich_text_area ''blogentry'', ''entry'' %></p> ??? Haven''t found
2006 Jun 06
0
Get value from form using rjs, and problem with Safari
Hi, I have got two forms, the first is a textarea plus a link that activates some javascript to change the form, the second activates some javascript on the onchange event which changes it into a textarea form. This works in Firefox, but not in Safari. Also, I need the value which is selected. I''ve found an example that gives the parameter to the javascript, like this: <input
2006 Jan 22
0
Get colum types in auto form
Hi all, I''m trying to build a routine that generates table rows with the appropriate field types (text_area and text_field for now), and filters out the ''created_at'' and ''deleted_at''. <% for column in Project.content_columns %> <tr class="ListLine<%= cycle("0","1") %>"> <td><%=
2006 Jun 06
1
Getting value of form using Ajax (and problems with Safari)
I have got two forms, the first is a textarea plus a link that activates some javascript to change the form, the second activates some javascript on the onchange event which changes it into a textarea form. This works in Firefox, but not in Safari. Also, I need the value which is selected. I''ve found an example that gives the parameter to the javascript, like this: <input
2011 Sep 13
3
Accessing Rails helper method with_output_buffer
Hi all, I cannot figure out how to correctly use the with_output_buffer helper method (located in ActionView::Helpers::CaptureHelper) inside a custom FormBuilder. Below follows a simplified example. I''m trying to achieve the following behavior in an ERB as suggested in the form_for helper docs in the Rails source: ========== <%= form_for @object, :builder => MyFormBuilder do
2009 Mar 11
1
NoMethodError for select_tag
Hello there. I am following a tutorial with rails 2.1 and I have come across a problem where <%= f.label :artist_id %><br /> <%= f.select_tag(:artist_id, options_for_select([[''choose one'', '''']] + @artists.collect {|art| [art.name, art.id]}, @album.artist_id)) %> (Old artist info:<%= @album.artist_old%>) gives undefined method
2007 Aug 20
0
FormBuilder in rjs
I have a page, which renders a partial that contains a ''State'' drop down list. Upon change, it re-renders the ''City'' drop down, re- populating it based on selected state_id: Page: /customer/new.rhtml <% form_for :customer, :url => customers_path do |f| %> State: <%= f.collection_select :state_id, State.find(:all), ''id'',
2008 Feb 17
0
Error "undefined method is_haml?" (custom form builder)
Hi all I''m experimenting with HAML. Sadly I''m getting an error on a page that doesn''t have anything to do with HAML (it''s a normal rhtml template)! undefined method `is_haml?'' for #<IncenseFormBuilder:0x31b0e88> It''s a custom form builder I have built, and I have no idea were this is_haml? comes from... Any idea? Thanks a lot. Josh --