Client Script detect if value of field is --None--

Andrew122
Mega Expert

I have a client script where if Field A is yes, I want Field B to change its value and if Field A is no or the default --None-- then I want Field B to change back to its original state.  I can't get the script to detect if Field A is --None--.  It works fine if Field A is  Yes or No.  I have tried just doing a blanket "else" statement and detecting if(Field A == '') but neither of those work.

My script is:

if(g_form.getValue('Field A' == 'yes'){

        g_form.setValue('Field B', 'yes')

}

else{

       g_form.setValue('Field B', 'no')

}

5 REPLIES 5

Unfortunately I need this to be an On Change script, as I need this to update as they fill out the form, not when they submit the form.