Hi
I have a model class ServiceDeskResolution.It has fields, code and
solution.I have to make the solution not empty .So for that I wrote
validates_presence_of :resolution
in the model.So from the view when I click save nothing is saved to
database.This is what I need.But no error messages are printed and the
view goes to next window..How can I print error messages in the
current window?
View code (define_sd_resolution.rhtml)
<%= error_messages_for ''service_desk_resolution'' %>
#This not
working
-------
-------code
<%= submit_to_remote ''save_btn'', ''Save'',
:html => {:class => "itilbutton1"},
:url => {:controller => ''service_desk'', :action
=>
''sd_resolution_save'', :id => @sd_ticket.id,
:sd_resolution_id =>
@sd_resolution_id}, :before =>
"checkResolution(document.getElementById(''sd_resolution_service_desk_resolution_code_id''),
''Please Choose Resolution'');" %>
controller code
def sd_resolution_save
@service_desk_resolution=ServiceDeskResolution.new(params[:sd_resolution])
@service_desk_resolution.save
render :action => "sd_resolution_save.rjs"
end
what I need is if !@service_desk_resolution.save how can i revert
this back to the same define_sd_resolution.rhtml and print the
validation message on that.
Thanks in advance
Sijo
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---