How to verify if a yes/no field has changed

Ok… this may be a very silly question and truth is, even I thought it was easy at first but I can’t seem to figure out how to get the change event to trigger when working with the yes/no fields.

I want to be able to unhide a field when a user chooses yes on a form and hide it when a user chooses no on the form. However, this form is not a form I created it is the default form the system creates when you click on the “add a new option” link in a form. It seems to generate its own form based on the scheme of that field.

Is there a special function for the yes/no fields… Is this done some other way other then the API that i have overlooked?

this is some of the coding options I have tried but nothing worked.
var radioButton=$(‘select#view_142-field_6’)
radioButton.change(function(){
console.log $(this).val();
if ($(this).val()) {
//do someting
}

//attempt #2
var radioButton=$(view_142-field_6’)
radioButton.change(function(){
console.log $(this).val();
if ($(this).val()) {
//do someting
}

Attempt #3
var radioButton=$(view_142-field_6’)
$(view_142-field_6’).change (function() {
if (radioButton.) {
console.log $(this).val();
if ($(this).val()) {
//do someting
}
});

I have checked through the API manual as well and they don’t talk about yes/no or even radio buttons (well at least not that I found).

any help would be appreciated.

Hello Mike,

You can easily do this by knack display Rule. we also do this by javascript but not required here.

you can check here by clicking add new option.

https://roberts.knack.com/farmers#add-item/

on form you can click on arraw pointed to right
image

Then the form is open, you can click then rule ->form rules
then add

Regards,
Sunny Singla
ssingla1985@gmail.com
+919855089359

Thank you… that worked… Much appreciated.

1 Like