Forum: Ruby on Rails error_messages_for

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ead43bcb0202410540a6a7cee5955d46?d=identicon&s=25 Fresh Mix (giga)
on 2009-02-21 17:23
Is it possible to print error message near the inputbox and not all on
top of the page by <%= error_messages_for 'users' %>

So if I have user registragion form and there ara inputs:

username
password
password_confirm
email

And if there some errors its prits errors near the input boxes:

username: [_________] Username should be (2 to 20 characters)
password: [_________]
password confirmation: [_________] Password did not match
email [____________]
81b61875e41eaa58887543635d556fca?d=identicon&s=25 Frederick Cheung (Guest)
on 2009-02-22 00:41
(Received via mailing list)
On Feb 21, 4:23 pm, Jo Jo <rails-mailing-l...@andreas-s.net> wrote:
> Is it possible to print error message near the inputbox and not all on
> top of the page by <%= error_messages_for 'users' %>
>
Yes and no. error_messages_for won't do it, but you have to realise
that error_messages_for is just a way of doing errors, this nothing
wrong with rolling your own thing (there's very little code in
error_messages_for). You might be interested in error_message_on which
gets you the error messages for a single attribute.

Fred
Fbd9cb107fe7c941333d6a3488691989?d=identicon&s=25 Ramon Tayag (ramontayag)
on 2009-02-22 12:42
(Received via mailing list)
You'll need to use f.error_messages and the form builder:

http://ramblingsonrails.com/how-to-make-a-custom-f...

Ramon Tayag



On Sun, Feb 22, 2009 at 12:23 AM, Jo Jo
This topic is locked and can not be replied to.