0
votes

I'm using the simple_form gem in Rails to create a form. To handle the server side errors I'm using:

<%= f.error_notification %>

And when the form is submitted and server-side errors are generated, they're generated in a p tag like so:

<p class="error_notification">Here are all the errors....</p>

I want wrap a div around the p element, because I'd like to create a red background for the message container via CSS, and I don't want to style the P element directly. Is there some way to do this inside of Rails with simple_form?

1
Do you mind the div-element being empty when there is no error? If not, just put <div> and </div> around the error_notification :)Veger
Yeah, that's what I was trying to avoid :)Matt Waldron

1 Answers

1
votes

I've seen this here: https://github.com/plataformatec/simple_form/blob/master/lib/generators/simple_form/templates/config/initializers/simple_form.rb, line 65

# Default tag used for error notification helper.
  config.error_notification_tag = :div