handling validation errors

Salil Gaikwad wrote:

Hi Sharanya,

render :update do |page|       if error occurs # write a condition which checks error occurs or not here           page.show , "errors"           page.replace_html, "errors", "Write a String after error occurs here."       else           page.hide , "errors"           # code u want to update if error not occurs.       end end

Check development.log if u running application in development mode for AJAX errors.

Thankx a lot. It is working with submit_to_remote itself after taking :update attribute from views page.

Hi Sharanya Suresh

     This you can also do with only a slight modification to submit_to_remote like

<%= submit_to_remote 'create', 'Create', :url => {:action => 'create'}, :update => {:success => 'success_div', :failure => 'failure_div'} %>

No other change in controller So for example

if @design.save      #do this else     #do if fail end

Sijo