Detect when -- None -- is selected

grosch
Mega Expert

For variables where I've checked the "include none" option, is there any way to tell when they picked none?   It doesn't look like the onChange method is called when that happens.   I'm wanting to hide some variables, for example, if they switch from a valid answer back to none

1 ACCEPTED SOLUTION

solutioningnow
Giga Guru

Hi,



In onChange script, you can check the value of field like below:


if(g_form.getValue('field') != '')



Generally. blank value is return if you select -- None --



Regards,


Solutioner


View solution in original post

3 REPLIES 3

solutioningnow
Giga Guru

Hi,



In onChange script, you can check the value of field like below:


if(g_form.getValue('field') != '')



Generally. blank value is return if you select -- None --



Regards,


Solutioner


harikrish_v
Mega Guru

Also Scott, you will have to make sure it is not a user created choice 'None', it should be the   'Include none' option so that you can compare it to blank.



Thanks & Regards,


Hari


grosch
Mega Expert

It looks like onChange is being called, and with a newValue, but the newValue is blank, like you said.   So I can basically do this:



      if (isLoading || !newValue || newValue.toString().length == 0) {


            // Either the page is first loading, or they've put the answer back to -- None --


      }