hi, how can I show the messages as the warning or errors in AEM fields for eg:
if I have two text fields then I have to put a condition in which the two fields cannot have the same name or values into it.
if that happens then It should show which the red marking or line around the text field as an error or warning .I want to ask how can I do that and where to put conditions for it.
thank you
Solved! Go to Solution.
Views
Replies
Total Likes
You can add the js file with category
"[granite.ui.coral.foundation]"
Or create your own category and add it cq:dialog using extraClientlibs as provided in below link
https://aemhints.com/2020/11/02/validating-dialog-value/
No need to add it dialog-ready
Hi,
You can add granite:class property to those 2 fields and using below script you can retrieve the values from fields and compare the value and show the error message if both are same
$(window).adaptTo("foundation-registry").register("foundation.validation.validator", {
selector: ".secondfield",
validate: function(el) {
var firstVal = $(".firstfield").val();
var secondVal = $(".secondfield").val();
//Compare the values and show error message
}
});
Check below post for detailed explanation
https://aemhints.com/2020/11/02/validating-dialog-value/
do I have to write this code inside
You can add the js file with category
"[granite.ui.coral.foundation]"
Or create your own category and add it cq:dialog using extraClientlibs as provided in below link
https://aemhints.com/2020/11/02/validating-dialog-value/
No need to add it dialog-ready
Views
Like
Replies