Displaying 20 results from an estimated 500 matches similar to: "How do i switch off error wrapping for a specific field?"
2006 Mar 26
1
How to override generated in validation html code?
Hi,
I would like to ask how to override validation functionality in RoR?
In active_record_helper.rb class there is "hardcoded" default html
generated durning validation.
If I will use
{code:ruby}
validates_presence_of :summary, :description
{code}
in my model class, there is html generated:
{code:html}
<div class="errorExplanation"
2006 Mar 25
7
Overriding <div class="fieldWithErrors">
Does anyone know how to override the <div class="fieldWithErrors">
behaviour when a form field is incorrect?
Thanks,
Dan
2006 Jan 19
5
TIP: Using field_error_proc to add style attributes to form elements
I just put this up on the wiki, and thought I''d share in case it''s
useful to anyone else. This is handy if you don?t want to wrap your
input elements inside a div when an error occurs, but instead want to
add some sort of CSS style to fields with errors:
ActionView::Base.field_error_proc = Proc.new do |html_tag, instance|
msg = instance.error_message
error_style =
2010 Oct 01
8
field_with_errors.
If a model doesn''t pass validation the field in the view is put under
a <div class="field_with_errors">.
But who create that div? field_text helper do it?
--
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 24
5
Changing default behavior of fieldWithErrors
Hi!
The topic can be a bit misleading, because it may suggest that i want to
change css style.
What i''d like to change is that normally, when there''s an error, rails
creates a div element with the fieldWithErrors class as the parent of
the input. I''d like to change this behavior, so the input element itself
will have this class added to its current classes and
2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error field
In my User form I have standard field to get user record attributes
(first_name, last_name and email)
I also have a select drop_down to choose a role from an array
first_name, last_name and email are user record attributes, but I
defined the role name as a virtual attribute
validates_presence_of :email, :last_name
attr_accessor :role_name
validates_presence_of :role_name, :if
=>
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
2006 Feb 13
3
Getting Rid of Error Divs around fields that have errors
Is there a way to get rid of the divs around an error field. These
divs are causing me headaches. Any suggestions :-)?
John Kopanas
http://www.kopanas.com
=====================================================================
http://www.soen.info - source of the freshest software engineering
information on the net
http://cusec.soen.info - software engineering conference
2009 Jun 25
4
standard ActiveRecord validation message
in testing my app I just use the validations
validates_presence_of :first_name, :last_name, :email
validates_presence_of :academy, :message => "You must select an
Academy"
validates_presence_of :role, :message => "You must select a role"
standard error_messages are fine for most of my fields , resulting
in :
5 errors prohibited this data from being saved
There
2010 Sep 23
7
errors.add, setting the whole message
Hi all. I have an attribute, job_role_id_short, that is being set in a
form. This field has a custom validation on it, which does this if it
fails:
self.errors.add(:job_role_id_short, "cannot be blank")
I want to add the error onto the attribute, so that the form builder
will wrap the field in a fieldWithErrors div. However, the error it
generates says "Job Role Short cannot
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for
The System model has_many children.
If I do this in my haml template:
-form_for @system do |s|
=s.text_field :name
-s.fields_for :children do |child_fields|
=child_fields.text_field :name
all is fine. The fields_for iterates over all children and puts the
correct data in the fields.
But...what I
2010 Feb 20
1
formhelper password_field only takes two arguments
When I look at the docs, password_field seems to take 3 arguments.
So when I ''play around" with things and I attempt to pass three
arguments to password_field ... I get an error saying that it only takes
two parameters ("3 for 2")
I am totally lost.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
2007 Mar 18
7
How to get more informations about an association at runtime
Hi all
I''m working on a Custom Formbuilder. I want it to create me with a
single method call checkboxes for a given HABTM association.
My model looks like this:
[code=ruby]class Member < ActiveRecord::Base
has_and_belongs_to_many :preferred_music_styles,
:class_name => ''MusicStyle'',
:join_table =>
2009 Jun 28
2
validation error messages in Form - how to disable the ActionView::Base.field_error_proc ?
I wrote the following code in my form view :
<li><label for="email">Email</label>
<%= form.text_field :email, :size => "30" %>
<span id=''email_error'' class=\''warning-text warning-text-indent\''><%=
@user.errors.on(:email) %></span></li>
the generated html code is the following :
<span
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 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 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
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
Overriding date_select in local project to use custom value rather than blank for starting option...
2005 May 08
3
Overriding date_select in local project to use custom value rather than blank for starting option...
I would like to have a date control on a page and I would like a
behavior similar to what you get using date_select with the
:include_blank => true option where the first value in the dropdown is
"- Month -", "- Day -", or "- Year -" rather than a blank value for
the respective month, day, and year select fields.
I took a look at the ruby source for
2006 Jul 18
2
Turn element hidden by default (ajax question)
(this is my first post on the ruby forum. If this is not the right place
for this type of question please let me know).
Ajax question
I have a checkbox that toggles the visibility of another element (a text
field) with the code:
---
<p><label for="checkbox">Appear!</label>
<%= check_box :object_name, :method, :onClick =>