Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change default "please include an @ in the email address"?

I've been able to change the error message when the user has not typed their email in yet, but how do I change the error message when the user types in their email with the wrong format?

This is my code written in Bootstrap 4 style:

<div class="form-group">
    <label>Email</label>
    <input type="email" name="email" required="" class="form-control" oninvalid="this.setCustomValidity('Please Enter valid email')" oninput="setCustomValidity('')">
</div>
like image 397
Anonymous Avatar asked Oct 19 '25 21:10

Anonymous


1 Answers

You simply can fix this with adding title to input tag

<input type="email" class="form-control" name="email" id="freeform_email"
                        placeholder="Enter an email" required="required"
                        oninvalid="this.setCustomValidity('Enter an email that contains &quot@&quot. Example: [email protected]')" title="Email: the email contains '@'. Example: [email protected]" />
                    

Yours should be then:

<div class="form-group">
    <label>Email</label>
    <input type="email" name="email" required="" class="form-control" oninvalid="this.setCustomValidity('Please Enter valid email')"  oninput="this.setCustomValidity('')" title='<your text>'">
</div>

You're welcome.

like image 167
Roshni Udhaya Avatar answered Oct 21 '25 11:10

Roshni Udhaya



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!