similar to: How to override generated in validation html code?

Displaying 20 results from an estimated 1200 matches similar to: "How to override generated in validation html code?"

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
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 27
17
Multiple Model Validation
Hey All ! I have a form which contains two models. I would like both models to be validated, but have their validations aggregated on the page. If I do: <%= error_messages_for(:model1) %> <%= error_messages_for(:model2) %> It puts two big validation blocks on the page. I would like all the errors from both models, but only in one validation box. Is this possible ? All my attempts
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 =>
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
2005 Dec 23
1
Overloading error_message_on method in ActiveRecordHelper
Hello all I would like to overload the error_message_on method in the ActiveRecordHelper module in order to emit a span tag instead of a div tag. I try to achieve this by way of plugins: Under vendor/plugins I''ve made a error_messages_on_fix directory, containing init.rb like this: --- require ''active_record_helper_fix'' --- ..and a lib directory with
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
2005 Jan 17
5
how to override rails errors messages?
hi, how can i override rails errors mesages (that are in english) to display them in an other language? thanks hangon
2006 Jun 13
7
help with ''error_messages_for''
Greetings, I''m in the throws of deploying an app on site5, and I''m getting strange errors. I think I might need to understand how error_messages_for works. I get a pretty standard looking error: " You have a nil object when you didn''t expect it! You might have expected an instance of ActiveRecord::Base. The error occured while evaluating nil.errors Extracted
2005 Dec 27
0
Re: RESOLVED: Overloading error_message_on method in ActiveRecordHelper
Leaving the body of the method the same as the default still throws the "stack level too deep" error. As a matter of fact, it only disappears if I comment out the ''require'' in line 1. As it turned out, it was the method definiton itself that caused problems. Ruby doesn''t have keyword arguments, but I tried calling the method as if it had. But when I changed
2006 Dec 12
2
Error message translation
I have a problem with translation of english phrase when an input error occurs. When I put: error_messages_for("registratie") above my view. I get the error: "xx errors prohibited this registratie from being saved". The problem now is, the site is for dutch customers and I would like to translate this to a dutch phrase. I know I can translate the individual fields with the
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
2006 Mar 01
5
scaffold.css and Rails tutorial problem
In iteration D.1 on page 109 I am not getting a styled error message box displayed at the top of the checkout as described in the tutorial and I cannot seem to discover where I have erred. The scaffold.css is copied from the pragmatic programmers site: #-------------------------------------------------------------------- $ cat public/stylesheets/scaffold.css body { background-color: #fff;
2006 Mar 27
3
Validation - How to pop up error messages
Hi, I''m trying to "validate" the input provided in the login form to see if "username" is entered or not? How do i do this ? In the model i have done like this validates_presence_of username, :body, :message => "Missing required field" But I''m not this message (Missing required field ) getting printed at all? How do i print this? Do i need
2007 Jul 15
0
errors_for
Been playing with merb. One of the helpers I liked in rails was on form validations. Found this was real easy to port over, so I thought I''d share. It doesn''t highlight the field with the error, but it gives that same nice little div on top. Say I had an articles controller def create @article = Article.new(params[:article]) @article.save! redirect
2007 Dec 05
5
Active Record, Migration, and Translation
Hi, I think the columns and table in migration should be able to have an optional "display_name" set manually. Something like: create_table :people, {display_name => "Personne"} do |t| t.column :first_name :string, :display_name => "Prénom". end Let me explain my point of view: Rails is a framework made to write programs in English. You see it when you