How can I hide a Field by default when the form has loaded and make it appear only when a condition has passed.
I want the 'Is employee terminating assignment' to be hidden by default when the form first loads. IF the first question is answered 'Yes' then i want the second drop down to appear.
I have used the examples you have provided but I don't get the outcome I expect.
The 'is the employee terminating one of their assignments' is still visible on form load. I want it to be hidden on form load and then appear if a User selects a Yes/No answer.
I am currently using this code:
//Show/Hides Terminating Assignment Field & More Information Button - [Wizard 1]
fd.spRendered(function() {
function hideOrShowDueDate() {
if (fd.field('Is_x0020_the_x0020_employee_x0020').value == 'Yes') {
// Hide Terminating Assignment Field and More information button
$(fd.field('Is_x0020_the_x0020_Employee_x002').value = 'No');
$(fd.field('Is_x0020_the_x0020_Employee_x002').$parent.$el).hide();
$('.Term-button').hide();
} else {
// Show the field
$(fd.field('Is_x0020_the_x0020_Employee_x002').$parent.$el).show();
$('.Term-button').show();
}
}
// Calling hideOrShow when the EmployeeIsLeaving value changes
fd.field('Is_x0020_the_x0020_employee_x0020').$on('change',hideOrShowDueDate);
// Calling hideOrShowDueDate on form loading
hideOrShowDueDate();