This conversation has been locked due to inactivity. Please create a new post.
This conversation has been locked due to inactivity. Please create a new post.
We have 2 textfields (firstname and secondname). If either of the 2 textfields are empty, on dialog submit, display an alert.
Thanks in advance
Solved! Go to Solution.
Views
Replies
Total Likes
HI @Dolly
as per your requirement you need to add your custom login on dialog submit .Sharing example snippet (this is just a example code, will not get compiled as is )
$(document).on("dialog-ready", function() {
$(document).on("click", ".cq-dialog-submit", function(e) {
var $form = $(this).closest("form.foundation-form");
var message;
var fui = $(window).adaptTo('foundation-ui'),
options = [{
id: 'ok',
text: 'OK',
primary: true
}];
var field1= $form.find("[name*='./field1']").val();
var field2= $form.find("[name*='./field2']").val();
//PUT YOUR LOGIC HERE
message = "ADD ERROR MESSAGE HERE";
}
if (message) {
fui.prompt("Error", message, "default", options);
return false;
}
});
HI @Dolly
as per your requirement you need to add your custom login on dialog submit .Sharing example snippet (this is just a example code, will not get compiled as is )
$(document).on("dialog-ready", function() {
$(document).on("click", ".cq-dialog-submit", function(e) {
var $form = $(this).closest("form.foundation-form");
var message;
var fui = $(window).adaptTo('foundation-ui'),
options = [{
id: 'ok',
text: 'OK',
primary: true
}];
var field1= $form.find("[name*='./field1']").val();
var field2= $form.find("[name*='./field2']").val();
//PUT YOUR LOGIC HERE
message = "ADD ERROR MESSAGE HERE";
}
if (message) {
fui.prompt("Error", message, "default", options);
return false;
}
});
This worked. Thanks @Dipti_Chauhan
Views
Likes
Replies
Views
Likes
Replies