Remote_form_for & error_message_on

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!

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
[email protected]