1

HTML5 provides alternate of JavaScript validation using Regular Expression. But I want to add multiple validation on single input field and according to that it should show the message.

For example.

<input type=passowrd name=passowrd/>

Here password field should contains following validation with message. enter image description here

1
  • 1
    Yeah, that's too complex for HTML alone. You need JavaScript to go along with it. Commented Jan 1, 2013 at 21:15

2 Answers 2

1

I'm afraid it cannot be done with HTML alone (no, not even HTML5).

You'll have to use JavaScript to achieve the task.

Sign up to request clarification or add additional context in comments.

Comments

1

Constraint validation is only designed for one error message per input field. A way to get around this is to concatenate the validation messages.

password.setCustomValidity(password.validationMessage + ' At least one capital letter');

The downside is that you can't append html, so all messages will be placed inline.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.