Displaying 20 results from an estimated 900 matches similar to: "FormBuilder-friendly labels?"
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
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'',
2006 Jun 05
3
ActiveRecord validations and FormBuilder
Hi,
I''m writing my own FormBuilder and I wanted to put an asterisk or
something next to any required fields. The Builder has access to the
AR object, is there any method I can call on the AR object that will
tell me whether or not a particular field is required? Failing that,
can I access the complete list of validations so I can look through
it for instances of
2006 Dec 05
1
Using render inside a FormBuilder (EdgeRails)
I''m using the latest trunk of 1.2-ish, and I''m wondering how to do what
I want to do. I am using a form_for :builder I wrote, simply called
TableFormBuilder after the rails cookbook, and want to be able to
present help icons automatically. I want these icons to appear next to
form fields I am rendering.
For example, I have this method in helpers/table_form_builder.rb:
# This
2009 Sep 06
1
How many attributes are there of a variable?
Hi,
According to the example below this email, attr(x,"names") is the same
as names(x). I am wondering how many attributes there are of a given
variable. How to find out what they are? Can I always use
some_attribute(x) instead of attr(x, "some_attribute")?
Regards,
Peng
> x=c(1,2,3)
> attr(x,"names")=c("a","b","c")
> x
a b c
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
--
2012 Oct 13
2
How to include html tag inside rails label tag
Hello pls help me,
below is my code
<label
style="width:175px;text_align:left;float:left;font-weight:bold;font-size:13px;">Group
<font size="1" color="red">*</font></label>
How to write this html code inside label_tag of rails ????
am clear till <font size="1" color="red">*</font>...
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
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
2009 Apr 12
3
Multi-button form
It cannot be this difficult, especially in rails. Here is my form code
in a partial for the index action of a controller:
<% form_tag({:controller => controller_name, :action => ''index''},
{:method => :get, :class => ''form''}) do %>
<div class="columns">
<div class="column left">
<p>
2006 Jul 11
0
Arbitrary elements in form_for?
I would like to use form_for in my project so that I can easily change
the style of many forms at once. However, it seems to me like
FormBuilders only support certain kinds of form elements(!). Surely
there must be a way to add arbitrary labels/form elements to a form.
Let''s say I had a form that looks like:
ID: (plain-text label)
Name: (text field)
Birthdate: (date chooser)
Picture:
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
2008 Dec 18
0
A question about text_field_tag value
This is my rails code:
<%= label_tag ''user_name_label'', ''User Name:'' %>
<%= text_field_tag ''user_name'', ''''%>
<%= label_tag ''view_name_label'', ''View Name:''%>
<%= text_field_tag ''view_name'', '''' %>
I defined a user name text field
2010 Jan 26
2
accepts_nested_attributes_for :has_many :through => 'bug?'
Hey guys & ladies!
I''ve got the following relationship which i''m trying to get
accepts_nested_attributes to work with. But when i submit my form, it
looks as if its expecting a Company object, rather than an array of
companies. which really doesn''t make sense considering its a
has_many :relationship.
So what i''m after, is a way to
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,
2010 Oct 11
0
Converting observe_field to UJS in Rails 3
I am trying to rewrite my website in Rails 3 and Ruby 1.9.2.
Can some one help me convert my observe_field which is working under
Rails 2.3.5 to Rails 3. I would like to avoid using JQuery as over the
last year everything I have tried in JQuery has failed, including this
one. Perhaps due to my lack of knowledge. I would not like to install
the legacy upgrade.
What I have in my website is several
2006 May 26
9
What syntax is this? belongs_to :Person
so when I''m reading the pick axe book second edition I don''t see
anything like the syntax you see people using in rails code.
Specifically when you see.
belongs_to :Person
has_many :Phones
etc
these are methods on ActiveRecord right?
Why is this invocation syntax never described in the Pick Axe book?
I do see things like attr_reader :some_attribute etc but you
2007 Oct 20
14
Problems with form_for and partials
i''m having problem with a form_for situation where i''m trying to DRY
out the repeated parts of my forms and put them in common/form and
render the form elements via another partial in controller_name/_form.
Here''s the first form
# app/views/common/form
<% form_for ... do |f| -%>
<%= render :partial => "params[:controller]/form", :object => f
2011 Mar 08
1
form_tag for search bar with Rails 3.0.5
I have a controller and view that should be providing a search bar
that brings up that brings up a selected record on submission. I have
tried several variations, including just specifying the assets_path,
but usually end up with either an error or a submission to the index
action, rather than the show action. Currently, I have the following
in my index.html.haml:
= form_tag({:controller =>
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 =