Contact form plugin - highlights fields with errors
Created 5 years ago by machinedean

Hi there,

We've been using your contact form plugin recently and one piece of feedback we've had is that it would be ideal that when validation fails that this is indicated on the screen to the end user. Ideally, a class would be applied to the field so we could highlight that and make more obvious!

Thought I'd share, it would make a big difference to contact forms that have a fair number of fields!

Thanks

Dean

ryanthompson  —  5 years ago Best Answer

Depending on how you display the form they should indeed be classed. However if you use manual output like {{ form.fields.name.input|raw }} for example you will need to add this yourself like this:

<div class="{{ form.hasError('field_slug') ? 'has-error' }}">
...
</div>

However that should be happening in the default field wrapper already: https://github.com/anomalylabs/streams-platform/blob/1.6/resources/views/form/partials/wrapper.twig#L5