Home > Mobile >  force user to enter year in YYYY format
force user to enter year in YYYY format

Time:12-13

I have this input

<form:input path="proposer.dobYear" id="proposer.dobYear"
    cssClass="input-text small dayfield only-digits validateFrontend" maxlength="4" />

I want the user to enter it in the format YYYY. With this I can still use the format YY. Is there any way I can force the user to enter the 4 character format?

CodePudding user response:

maxlength attribute should be used along with minlength attribute in this case and they both should be 4 because you want the user to exactly type 4 digits.

  • Related