You need to sign in to do that
Don't have an account?
JohnB
validation rules in Lightning modal
I'm using a wrapper to display the standard record edit screen in a modal. However, none of the validation rules are being handled. They are still being triggered somehow, because the force:recordSaveSuccess is not being sent when there is an error.
Ideally, I would simply get the same behavior within the modal that I get in the default screen (dependent fields highlighted in red with error messages). As it is, there is no indication of the errors anywhere.
This is how I call the edit screen from within the lightning modal
<force:recordEdit aura:id="edit" recordId="{!v.itemRecordId}"/>
I hope I've stated this clearly. I appreciate any help or suggestions.
Ideally, I would simply get the same behavior within the modal that I get in the default screen (dependent fields highlighted in red with error messages). As it is, there is no indication of the errors anywhere.
This is how I call the edit screen from within the lightning modal
<force:recordEdit aura:id="edit" recordId="{!v.itemRecordId}"/>
I hope I've stated this clearly. I appreciate any help or suggestions.
Please try this validation code:
({
validateEmail : function(component, event, helper) {
var isValidEmail = true;
var emailField = component.find("leadEMail");
var emailFieldValue = emailField.get("v.value");
if(!$A.util.isEmpty(emailFieldValue)){
if(emailFieldValue.match(regExpEmailformat)){
emailField.set("v.errors", [{message: null}]);
$A.util.removeClass(emailField, 'slds-has-error');
isValidEmail = true;
}else{
$A.util.addClass(emailField, 'slds-has-error');
emailField.set("v.errors", [{message: "Please Enter a Valid Email Address"}]);
isValidEmail = false;
}
}
},
})
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks,
Ajay Dubedi