How to make input mandatory?

Asked

Viewed 109 times

-4

want to make that a input be mandatory, example, I ask xxxxx, and the person clicks on continue and erroneo, I want to get out a text saying "put your xxxx:"

<input type="email" id="user_id" name="user_id" placeholder="" autocomplete="on" autocapitalize="none" spellcheck="false" autocorrect="off" class="andes-form-control__field" maxlength="120" autofocus="">
  • 1

    required in input

  • 1

    If you want the form not to be submitted, add the attribute required no input, however if you want to display some error message you will have to use Javascript.

  • I think I got it because if I don’t type anything by clicking on move on not Vanca and if I type anything see it also not Vanca,. If I do an email, how do I get it to display an error message by talking to collect the email? - marceloquiroga 2 mins ago Edit Remove

1 answer

2

to be clear the input would look like this:

<input type="email" required id="user_id">

Remembering that to be validated accurately is inside a form

I put the required in another position to illustrate that it can be in a different position.

  • add the required at the end of any code I put? or create a new imput like Voce put up..

  • You will add the required. It can be at any position actually. <input required type="email" id="user_id">

  • I think I got it because if I don’t type anything by clicking on move on not Vanca and if I type anything see it also not Vanca,. If I make an email it will put as I do it display an error message talking to collect the email?

  • if the input type is type="email"it will say that what was typed is not valid, if number validates as well and so will

  • Don’t forget to evaluate the answer :)

  • it is like email but no error appears just do not proceed..

  • Got it, which browser you’re using?

Show 2 more comments

Browser other questions tagged

You are not signed in. Login or sign up in order to post.