Dear all, any idea on how to implement similar Masked Input on Data Table?
Hello @AdityaGiriHertanto,
You can add DataTable Column validators for the specific column in a table so that users cannot switch focus to other columns until this one is validated.
Please find more information about addColumnValidator method in the documentation here.
Hello @mnikitina,
Thanks for your response. Tried to implement the sample code on my forms, but it seems not working. Could you help to guide me again? I need to limit number of character and only accept numeric for specific field. (sorry, I'm not good with coding)
fd.control('TableConsolidate').addValidator({
error: 'Error message',
validate: function(value) {
if (value.length == 0) {
this.error = "Add at least one record to the table";
return false;
}
if (value.length > 3) {
this.error = "Don't add more than 10 records to the table";
return false;
}
return true;
}
});
Hello @AdityaGiriHertanto,
You can set the column type to be equal Number, thus column will only accept numbers. Also, you can set up the number format and min/max value.
If you want to validate the number of signs, you need to addColumnValidator method, like this:
fd.spRendered(function() {
fd.control('DataTable0').addColumnValidator('Column1', {
error: 'Error message',
validate: function(value) {
//check the number of characters
if (value.length != 3) {
this.error = 'Error message';
return false;
}
return true;
}
});
});