mark_all_input_fields_valid(); <% if (defined?(resource) != nil) && !resource.nil? %> <% if resource.errors.size > 0 %> <% resource.errors.each do |attrib,message| %> <% if attrib =~ /recaptcha/ %> show_modal_error_message("<%= escape_javascript(message) %>"); <% else %> var resource_name = "<%= resource.class.name.underscore %>"; var attribute_name = "<%= attrib %>"; var field_id = resource_name + "_" + attribute_name; var message = "<%= message.html_safe %>"; //invalidate_input_field internally checks to see if the field exists, otherwise it internally calls show_modal_error_message to show the error in the callout box above the form fields. //this currently happens when errors are returned on additional_login_param, which as a field never exists. invalidate_input_field(field_id,"<%= message.html_safe %>"); <% end %> <% end %> <% end %> <% end %> //this conditions happens if an errors variable has been explicitly passed to this errors modal. //currently this is only done when a ActionController::RoutingError is raised , that too at the moment via the not_found def in the otpcontroller. <% if (defined?(errors) != nil) %> show_modal_error_message("<%= errors[0].to_s %>"); <% end %>