Hide a field unless 'Yes' radio button selected

Hi,

I'm new to this, and am having some problems with what I'm sure should be a simple task.

If the user selects Yes for 'any other action taken'...

The display the 'other action details' field.

Below is the code I have at present, and it is completely non-functional. Any assistance would be appreciated.

fd.rendered(function() {

function ShowActionTaken() {

    if (fd.field('Any_other_action_taken').value() == 'Yes') {
        $(fd.field('Other_action_details').$parent.$el).show();
    } else {
        $(fd.field('Other_action_details').$parent.$el).hide();
    }
}
fd.field('Any_other_action_taken').$on('change',ShowActionTaken);

ShowActionTaken();

});

Hello @danNZ,

Welcome to Plumsail Community!

To get or set field's value you need to use this code, without brackets:

fd.field('Any_other_action_taken').value;

Please try out the updated code:

fd.rendered(function() {

function ShowActionTaken() {

    if (fd.field('Any_other_action_taken').value == 'Yes') {
        $(fd.field('Other_action_details').$parent.$el).show();
    } else {
        $(fd.field('Other_action_details').$parent.$el).hide();
    }
}
fd.field('Any_other_action_taken').$on('change',ShowActionTaken);

ShowActionTaken();
});

Thank you, that's working!

1 Like