A
A
Alexander Babiy2019-02-25 14:04:30
Bootstrap
Alexander Babiy, 2019-02-25 14:04:30

How to do email validation in bootstrap 4?

Hello!
How to do email validation in Bootstrap 4?
HTML 5 displays a message in a tooltip if you use a pattern for example, but you need to display this message in the error field, because in bootstrap this tooltip is visible only on hover and the user does not understand what's wrong.
How to get it out?
Thanks
7b177-clip-7kb.png?nocache=1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
B
bkosun, 2019-02-25
@bkosun

<form>
  <div class="form-group">
    <label for="exampleInputEmail1">Email address</label>
    <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Enter email">
    <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
  </div>
  <div class="form-group">
    <label for="exampleInputPassword1">Password</label>
    <input type="password" class="form-control" id="exampleInputPassword1" placeholder="Password">
  </div>
  <div class="form-check">
    <input type="checkbox" class="form-check-input" id="exampleCheck1">
    <label class="form-check-label" for="exampleCheck1">Check me out</label>
  </div>
  <button type="submit" class="btn btn-primary">Submit</button>
</form>

https://getbootstrap.com/docs/4.0/components/forms...
This is the native way to validate a field, so the way the error is displayed will be different in different browsers.
https://developer.mozilla.org/en-US/docs/Web/HTML/...
If you want to add your own handler use Constraint validation
https://stackoverflow.com/questions/24391078/how-t.. .
https://developer.mozilla.org/en-US/docs/Web/Guide...
https://www.html5rocks.com/en/tutorials/forms/cons...
An easier way is to use ready-made validators e.g. jQuery-validation:
https://jqueryvalidation.org/files/demo/bootstrap/...

V
Viktor Taran, 2019-02-25
@shambler81

My friend, so you write correctly
, I want a validator, then you will get,
for example ,
bootstrapvalidator.votintsev.ru/getting-started
https://formvalidation.io
In general, this is not quite a bootstrap, since you need to do it either in php when hit or in js, so that will go any

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question