Control Placement of alerts/error messages

How can I control the placement of error messages when a user does not complete a field properly? I could not find any info on this. I want them to appear under the field that has the issue.

Thanks,
Amedeo

Hi @adicarlo,

I am not sure why but the code is not showing the message text properly.

In your screenshot, it shows

<input class="form-control form-control-email" placeholder="Email" name="email" id="f-email" type="email" required="" data-rule-email="">

It should be this:

<input class="form-control form-control-email" placeholder="Email" name="email" id="f-email" type="email" required="email field is required." data-rule-email="Please enter a valid email address"> 

Hope that helps. :slight_smile:

If you wrap the text input in a form-row, you will get the required result.

  1. Wrapped in form-row
  2. No form-row

Result:

image

Each of your form inputs (along with any labels they use) should be wrapped in:

<div class="form-group">

And that’s usually the case when you use Wappler to create the form.

Thank you all, tried Teodor’s solution and it worked, I used a form template so it was not Wappler generated.

1 Like