search for: field_error_proc

Displaying 18 results from an estimated 18 matches for "field_error_proc".

2009 Jun 28
2
validation error messages in Form - how to disable the ActionView::Base.field_error_proc ?
...user[email]" id="user_email"/> <span warning-text-indent\="" class="\''warning-text" id="email_error">should look like an email address.is too short (minimum is 6 characters)</span> is there any way to disable the ActionView::Base.field_error_proc in the config file ?
2008 Jul 06
1
ActionView::Base.field_error_proc not getting an error field
...:email, :last_name attr_accessor :role_name validates_presence_of :role_name, :if => :role_name_required?, :message => ''must be selected'' when testing with a blank form, I get all errors detected during User model validation, which is fine... BUT ActionView::Base.field_error_proc doesn''t get the role_name error, so I cannot change the style of the select I checked it , debugging the proc : ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| debugger .. I just get the html_tag for email and last_name, never for role_name ... what''s w...
2013 Apr 10
1
Per form field_error_proc
...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 it because of I think it isn''t good object desing. How complicated would be adding some extra option to formbuilder, like :form_field_error_proc, that can be propagated down to the ActiveRecord''s InstanceTag implementation? Or have you some other idea how to make this better? :) Best regards, Lukas -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe...
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 Jul 05
0
ActionView::Base.field_error_proc where to put it?
I found out that ActionView::Base.field_error_proc can be modified to output whatever error format I want for webform elements. At the moment I have it sitting in application_helper.rb and it works just fine. However, I feel that it isn''t the proper place for it. Where do you normally store modified classes? Thanks. -- Posted via ht...
2007 Apr 09
4
How do i switch off error wrapping for a specific field?
...error wrapping off while using the FormHelper methods. As error_wrapping is a method in InstanceTag (and not of FormHelper), it is pretty hard to have a FormBuilder change its behaviour. One possibility is to define def initialize(object_name, object, template, options, proc) ActionView::Base.field_error_proc = lambda do |html_tag, instance| html_tag end super(object_name, object, template, options, proc) end which works, but i consider it an unclean solution (as it would change the error_proc for the wh...
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 = "background-color: #f2afaf" if html_tag =~ /<(input|textarea|select)[^>]+style=/ style_attribute = html_tag =~ /style=[''"]/ html_tag.insert(style_attribute + 7, "#{err...
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 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"
2010 Oct 06
0
Error customization problem.
..."State cannot be blank." validates_presence_of :zipcode,:message => "Zip Code cannot be blank." validates_presence_of :country,:message => "Country cannot be blank." end also in my environment file(environment.rb) #Customize errors config.action_view.field_error_proc = Proc.new do |html_tag, instance| if instance.error_message.kind_of?(Array) %{<div class="input">#{html_tag}</div><div class="error">&bull;#{[instance.error_message].join(''<br/>&bull;'')}</div>} else %{&lt...
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
2010 Feb 19
3
Hooking validates
I want to hook the validation routines so that I can flag html labels and change their color to better indicate which fields need to be corrected in a form. Is there a way to do this conveniently and/or conventionally? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this
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
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
2006 Apr 12
0
Validating collections
I saw this issue addressed in mid-January under the heading ''TIP: Using field_error_proc to add style attributes to form elements'', but I didn''t quite get it. I have a collection of objects that I want to input in one form and validate (during update). The suggestion in the post I referred to above was to use something like [in form] > <% for @comment in @po...
2008 Dec 11
2
uninitialized constant ActionVie
Hello I am trying to transform my web app into a 2.2 ready app, in my config/environment.rb I wrote Rails::Initializer.run do |config| ..... # disabling the surrounding div if validation error ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| if html_tag.include?("class=") html_tag.sub(%r{(class=["''])}, ''\1invalid '') else html_tag.sub(%r{(<[^ ]+ )}, ''\1class="invalid" '') end end .. end BUT running the co...
2010 Dec 14
4
Custom form error messages
Hi, What do I have to override in order to be able to have the error message of each field in front of the input field? I haven''t been able to find anything similar on google. All I''ve found is how to override the container around the input field. ActionView::Base.field_error_proc = Proc.new { |html_tag, instance| "<span class=\"fieldWithErrors\">#{html_tag}</span>" } Or in here do we have access of the error message of the current field? Greg -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscrib...
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