mirror of
https://github.com/pierre42100/ComunicWeb
synced 2025-06-19 04:15:17 +00:00
Enforce first name & last name policies
This commit is contained in:
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user