Enforce first name & last name policies

This commit is contained in:
2021-04-16 07:54:03 +02:00
parent fd03975508
commit 437b4cba1b
5 changed files with 41 additions and 24 deletions

View File

@ -10,9 +10,10 @@ const FormChecker = {
*
* @param {elem} input The input element to check
* @param {Boolean} inFormGroup Specify wether the input is in a formgroup or not
* @param {number} minLength Minimum length of input
* @return {Boolean} True or false depending of the validity of the field
*/
checkInput: function(input, inFormGroup){
checkInput: function(input, inFormGroup, minLength = 3){
//Check input existence
if(!input){
//Error message
@ -28,7 +29,7 @@ const FormChecker = {
//TextInput
if(inputType == "text"){
inputOK = (input.value.length < 3 ? false:true);
inputOK = (input.value.length < minLength ? false:true);
}
//MailInput

View File

@ -228,6 +228,7 @@ function checkMail(emailAddress){
* * @info {string} value The default value of the input
* * @info {boolean} disabled Set whether the field should be disabled or not
* * @info {string} additionalGroupClasses Additionnal form group class names
* * @info {number} maxLength Maximum allowed length for input
* @return {HTMLElement} The input
*/
function createFormGroup(infos){
@ -364,6 +365,9 @@ function createFormGroup(infos){
input.placeholder = infos.placeholder;
input.value = value;
input.disabled = disabled;
if (infos.maxLength)
input.maxLength = infos.maxLength;
}
//Return input