Forum: Ruby on Rails Ajax form error handling

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.
3b87f1ad86f6a44241832314873e8d54?d=identicon&s=25 Ryan Lundie (Guest)
on 2006-04-28 21:17
Hi,

I have a customer add form in which i call form_remote_tag to update a
customer list within another div on my page.

I need to also, however, allow for proper error checking, and the issue
is that the form_remote_tag will only update a single div tag.

I have seen a few ways to deal with this, but I want to know what the
best way is, while still allowing the model to do all of the
verification.

Thanks,
Ryan Lundie
6e03895e5abb46f3daf4aafad3b98d5c?d=identicon&s=25 Randal Santia (Guest)
on 2006-04-28 22:37
Ryan Lundie wrote:
> Hi,
>
> I have a customer add form in which i call form_remote_tag to update a
> customer list within another div on my page.
>
> I need to also, however, allow for proper error checking, and the issue
> is that the form_remote_tag will only update a single div tag.
>
> I have seen a few ways to deal with this, but I want to know what the
> best way is, while still allowing the model to do all of the
> verification.
>
> Thanks,
> Ryan Lundie

I have NO idea how to do it...  :(

Someone help us ( I work with Ryan )
88c6f6f0eb4f46caaf7329016249afdd?d=identicon&s=25 peter (Guest)
on 2006-04-29 17:28
with rjs you can solve this

if @object.save
  normal_routine
else
   page.replace_html 'error_div', content_tag( 'div', error_message_on(
'model', 'field' ), 'class' => 'error_text' )
end

hope that helps
This topic is locked and can not be replied to.