I am using the following is a sample validate_on_update action in my
model:
validate_on_update
if internet_access == "Y"
if internet_use.blank?
errors.add_to_base("Please describe your internet use.")
end
end
end
This successfully throws the validation error if internet access is
checked and internet use is left blank, however it does not properly
highlight the field that was left blank (in this case "internet_use").
Any suggestions?
--
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 group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Dec 9, 1:34 pm, Brian Penrose <li...-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> This successfully throws the validation error if internet access is > checked and internet use is left blank, however it does not properly > highlight the field that was left blank (in this case "internet_use"). > Any suggestions?When you use add_to_base method, it adds it to the base of the form, not a specific field. You can add the error to the internet_use field: errors.add(:internet_use, "Please describe your internet use.") -- 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 rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.