Hi Melvyn, welcome to the forum!
To answer your question, yes that is possible. All fields in your form can be hidden based on a field called "visible
". Take this radio button for example:
{
"label": "How many do you have?",
"model": "numOfOranges",
"styleClasses": "col-md-4",
"type": "radios",
"values": ["2", "3"],
"visible": false
},
The "visible"
takes a boolean value which is set to false, so the radio button will be hidden. But what if I wanted to conditionally show the radio button?
Some fields can be calculated, meaning they can use JavaScript to calculate a dynamic result. Here’s an example of two radio buttons, one which is regular, and one which is conditionally shown based of the former:
{
"label": "Have you got any oranges?",
"model": "hasOrange",
"styleClasses": "col-md-4",
"type": "radios",
"values": ["Yes", "No"]
}, {
"label": "How many do you have?",
"model": "numOfOranges",
"styleClasses": "col-md-4",
"type": "radios",
"values": ["2", "3"],
"visible_calc": "model.hasOrange == 'Yes'"
}
The second radio button has the field "visible_calc"
which checks whether or not the selected option of the first radio button was ‘Yes’ or not. If ‘Yes’, it would be true and be visible, else it would be hidden.
End Result:
Hope this helps!