I have a toggle which once switched to Yes, I want it to show a field that's just below it. but if left on No, the field should stay hidden.
How do I accomplish this?
I have a toggle which once switched to Yes, I want it to show a field that's just below it. but if left on No, the field should stay hidden.
How do I accomplish this?
Dear @Viorel,
With JavaScript, something like that should work:
fd.spRendered(function() {
function hideOrShowField() {
if (fd.field('YesNo').value) {
// Show the MyField field
fd.field('MyField').hidden = false;
} else {
// Hide the MyField field
fd.field('MyField').hidden = true;
}
}
// Calling hideOrShowField when the YesNo value changes
fd.field('YesNo').$on('change',hideOrShowField);
// Calling hideOrShowFieldon form loading
hideOrShowField();
});
More examples of working with fields here - Work with SharePoint form fields in JavaScript — SharePoint forms