I want to color a Yes/No Field
Yes would show in green
No would show in red
Looking thru the forum, I found some reference to this, but don't see the complete code...
this is what I have that I know is wrong and not working. Suggestions on how to fix?
trying to add to the default code that is already there
thanks
fd.spRendered(function () {
// This code is executed once the form is rendered
// Populating Resolution Date with the current date when a user sets
// Status field to 'Resolved'
fd.field('Status').$on('change', function (value) {
if (value === 'Resolved') {
fd.field('ResolutionDate').value = new Date();
}
})
});
fd.spRendered(function() {
if (fd.field('_x0031__x002e__x0020_Are_x0020_t').value = FALSE){
$(fd.field('_x0031__x002e__x0020_Are_x0020_t').$el).k-switch-on .k-switch-container {
background-color: red !important;
}
})
});
There is no need in a code for this. You can change the color of the Yes-No toggle using the CSS:
.form-switch > .form-check-input:checked{
background-color: green !important;
border-color: green !important;
}
.form-switch > .form-check-input{
background-color: red !important;
border-color: red !important;
}