Displaying 20 results from an estimated 1000 matches similar to: "field_with_errors."
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 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
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 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 =
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 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
=>
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 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
2006 Jun 02
0
field_with_errors not showing
My views won''t wrap a field with the <div> tag when validations return
errors. I can generate a list of the items, but it''s not wrapping the
fields. I know you can manipulate how ActionView does a field with
errors, but I have not changed it.
Does anyone know the reason for this? I''ve asked several times on IRC
and no one seems to know.
My form itself
2010 May 17
6
Should an blank string be html_safe?
Just trying to implement a simple helper over the past few days had me
really confused.
messages = ''''
messages << content_tag(:p, ''dave'')
#=> <p>dave<\p%;gt;
Eventually I realised the original empty string was not html_safe
message = ''''.html_safe
message << content_tag(:p, ''dave'')
#=>
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
2011 Feb 09
16
rails 3.0.4 broke yield :javascript ?
hello,
I have today updated my rails app to 3.0.4 security release but now this
yield :javascripts
fails in the layout and I get my custom js escaped as text in the view.
anybody seeing this also?
tia,
jk
--
www.least-significant-bit.com
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group.
To post to this group, send email to
2010 Nov 05
9
[patch] Let's use <%== %> instead of <%= raw() %>
I''ve submitted a small patch to make Rails behave properly with the
Erubis <%== %> construct. For some reason the current behaviour of
that tag in Rails 3 is to escape the contents _twice_ which is
probably a bug.
I offer three suggestions why this is a good idea:
- The syntax is cleaner. It can avoid a lot of .html_safe and raw in
your views. I especially like the conciseness of
2011 Jul 15
3
Ruby variable that embeds html tags
This seems very simple, but I can''t quite get it. Probably because I''m
just starting out with RoR.
My view has a slew of labels and text fields; many are "required":
<%= f.text_field :screen_name %> <span class="required_field">Required
field</span>
(The "required_field" class turns the text red and smaller.) I''d like
to
2011 Feb 24
1
Rails 3 save parent model and association if nested attributes validation fails for uniqueness
Hi,
Song
has_and_belongs_to_many :people
accepts_nested_attributes_for :people
Person
validates :uniqueness => true
If person record not present, nested attributes working great! in rails way.
i.e., inserting into songs, people and people_songs table correctly.
I am interested in:-
*If there is person exist, it should skip insertion into people table but
data should be inserted in songs and
2012 Feb 17
5
undefined method `key?' for nil:NilClass PaperClip
Hello, I have a problem with the paperclip, I put on my GemFile
gem "paperclip", "~> 2.6.0"
I create a migrate
class FileUpload < ActiveRecord::Migration
def up
change_table :projects do |t|
t.has_attached_file :image
end
end
def down
drop_attached_file :projects, :image
end
end
on my model I put
class Project < ActiveRecord::Base
2010 Aug 03
7
rails 2.3.8 and html_safe
Hi,
Can somebody update me on the state of html_safe strings in rails 2.3.8?
I know rails 2.3.6 and 2.3.7 broke a lot of code because strings were
being escaped when they shouldn''t have been and I thought this was all
fixed in 2.3.8.
I''m upgrading an app from 2.3.5 to 2.3.8 and there are many spots where
previous code was output correctly and now it expects html_safe method
2006 Nov 24
13
rSpec on Rails 1.2?
I just updated my Rails install to the most current Edge and my
controller specs fail:
1)
TypeError in ''The User Controller should be a user controller''
can''t convert nil into String
Each spec fails the same way.
<context string> <spec string>
can''t convert nil into String
Any ideas what''s up with this?
Thanks,
s.ross
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