Skip to content

Form fields only display single error #331

@TimMoser92

Description

@TimMoser92

Because of the following code, trestle admin only displays a single error even if mutliple errors exist for a single field. In my specific case there is a multi-select with two errors happening at once. The user will only be shown one at a time and has to fix them one after another.

def error_message
content_tag(:p, class: "invalid-feedback") do
safe_join([icon("fa fa-warning"), errors.first], " ")
end
end

I would suggest changing errors.first and iterate over all errors, sth. like this:

 def error_message 
   content_tag(:p, class: "invalid-feedback") do 
     errors.map do |error|
       safe_join([icon("fa fa-warning"), error], " ")
     end.safe_join("\n") 
   end 
 end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions