Using slim and rails 6, with simple form, I can add an error message to a variety of fields. For example, the following code will generate a form that will display the error "Your name is required" if it is left blank and the user tries to submit / save the form.
= simple_form_for(@dating_card) do |f|
.form_inputs
= f.input :FirstName, label: 'Your First Name:', error: 'You name is required'
However, when I do the following, the error for the file_field doesn't show up if I leave it blank and try to submit:
= simple_form_for(@dating_card) do |f|
.form_inputs
= f.input :FirstName, label: 'Your First Name:', error: 'Your name is required'
= f.file_field :images, multiple: true, required: true, accept: ' image/png,image/gif,image/jpeg', error: "There was an error with the images. Please try again"
I've looked through the simple-form documentation, and can't find anything. I can add errors via the controller validations, but I don't know how to get that to be consistent with the simple-form, inline validations. Any help is much appreciated.
UPDATE:
Here are the two pieces of rendered HTML which correspond with the form inputs above. The first is for the First Name field:
<div class="form-group string required dating_card_FirstName form-group-invalid" data-children-count="1"><label class="string required" for="dating_card_FirstName">Your First Name: <abbr title="required" data-children-count="0">*</abbr></label><input class="form-control is-invalid string required" aria-invalid="true" type="text" value="" name="dating_card[FirstName]" id="dating_card_FirstName" data-kwimpalastatus="alive" data-kwimpalaid="1595368187456-0"><div class="invalid-feedback">You name can't be left blank.</div>
and
<input multiple="multiple" required="required" accept="image/png,image/gif,image/jpeg" error="There was an error with the images" type="file" name="dating_card[images][]" id="dating_card_images">
...
In the model validations, I can add a custom validator, but I'm not sure how to get the front end to render the errors in the same way as the rest of the simple_form.