I have a datatable that has 4 columns. Column 2 is a dropdown...and when "Other" is selected I need to allow the third column to be editable and required.
I have the below code that is only partially working. It will allow for the third column to turn editable but it allows it to be submitted with nothing in the column.
fd.control('ViolationTable').addColumnValidator('Violation', {
error: 'Message',
validate: function (value) {
if (value == 'Other (Type in next field)') {
fd.control('ViolationTable').columns[2].editable = function () {
return true
};
fd.control('ViolationTable').columns[2].required = function () {
return true
};
return true;
fd.control('ViolationTable').addColumnValidator('Other', {
error: 'Message',
validate: function (value) {
if (value.length < 1) {
return false;
}
}
});
}
fd.control('ViolationTable').columns[2].editable = function () {
return false
};
fd.control('ViolationTable').columns[2].required = function () {
return false
};
return true;
}
});