I have one Lightning input in which I have to show the error message if condition is not satisfied.
1.4 characters min
2.12 characters max
3.Allowed characters: Letters (A,B,M....26 capital letters of the English alphabet)
4.Digits (1,2,3....)
5.Dash ( - )
- It must contain at least 1 digit
Need to check and show different error message for different condition if not satisfied in Aura Component in JS. help with this how can I achieve this in aura
Controller:
if( 4 > updatedAFName.length )
{
let errorMessage= "Le numéro d'adhésion ne peut pas contenir moins de 4 caractères";
helper.showToast(component, event, helper,afLabel,errorMessage,"error");
component.set("v.isInEditingMode", true);
component.set("v.isInSavingMode", true);
}
else if(updatedAFName.length > 12 )
{
let errorMessage= "Le numéro d'adhésion ne peut pas excéder 12 caractères";
let afLabel= $A.get("$Label.c.TM_B02_APPLICATION_FILE");
helper.showToast(component, event, helper,afLabel,errorMessage,"error");
}
else{
if(isChangeAFName) {
component.set("v.IsApplicationNumberModalOpen", true);
component.set("v.isChangeAFName", true);
}
component.set("v.isInEditingMode", true);
component.set("v.isInSavingMode", true);
//component.set("v.IsApplicationNumberModalOpen", true);
}```