remote_form_for タグを使用して送信するフォームがあります。
意見
<% form_remote_tag(:url => { :action => 'create' }) do %>
a bunch of fields
<% end %>
コントローラ
def create
if @greeting.can_save?
respond_to do |format|
format.html {redirect_to board_link(@board)}
format.js #close the iframe and reload the parent
end
else
respond_to do |format|
format.html {redirect_to :action => 'new'}
format.js #show the errors on the form
end
end
end
create.rjs
page << "parent.$.fancybox.close();"
正しい情報で送信されたフォームでは、すべて正常に機能します。しかし、無効な送信のエラー メッセージを表示する必要があります。
フォームが検証に合格しない場合、フォームにエラー メッセージを表示するにはどうすればよいですか?
前もって感謝します。