# Remote\_form\_for & error\_message\_on

**URL:** <https://www.ruby-forum.com/t/remote-form-for-error-message-on/112216>\
**Category:** Rails\
**Created:** [August 16, 2007, 2:18pm UTC](https://www.ruby-forum.com/t/remote-form-for-error-message-on/112216 "2007-08-16T14:18:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mindtonic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f19dbf/32.png) [@mindtonic](https://www.ruby-forum.com/u/mindtonic)\
**Post date:** [August 16, 2007, 2:18pm UTC](https://www.ruby-forum.com/t/remote-form-for-error-message-on/112216/1 "2007-08-16T14:18:56Z")

</div>

Hello,

I am working with remote\_form\_for.

How do you properly return any error messages generated by the model  
for display in error\_message\_on?

I can’t seem to find any information about it.

Thanks!

---

<div class="post-metadata">

**Author:** ![mindtonic](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/f19dbf/32.png) [@mindtonic](https://www.ruby-forum.com/u/mindtonic)\
**Post date:** [August 16, 2007, 4:08pm UTC](https://www.ruby-forum.com/t/remote-form-for-error-message-on/112216/2 "2007-08-16T16:08:13Z")

</div>

Use flash.now[:error] instead of flash[:error] so that the flash will be  
displayed immediately. Also, you will need to update the div that  
displays your flash since you are not reloading the entire page. This is  
easiest using rjs. If you have your flash view code in a partial, a  
helper in application\_helper.rb like:

```
  #helper to update the flash
  def update_flash
    page[:flash].replace_html :partial => '/shared/flashes'
  end

```

This would allow you to do:

```
render :update do |page|
    page.update_flash
    ...
end

```

Hope this helps.

Mindtonic wrote:

> >

–  
Sincerely,

William P.

[http://www.billpratt.net](http://www.billpratt.net)  
removed\_email\_address@domain.invalid
