The CreatorCon Call for Content is officially open! Get started here.

While giving None in the field mandatory is not happening in catalog

keerthi19
Tera Guru

Hi ,

I have 2 field and it has dependency . script below

function onChange(control, oldValue, newValue, isLoading) {

if (isLoading || newValue == '') {

g_form.clearOptions('Sample2');

g_form.clearValue('Sample2');

    }

    var ostype = g_form.getValue('os_type');

g_form.clearOptions('os_version');

  if (Sample1 == 'win')

  {

  g_form.addOption('Sample2','field1','Field1');

  g_form.addOption('Sample2', 'fiel2','Fiel2');

    }

else if(Sample1 == 'linux'){

                      g_form.addOption('Sample2', 'field3','Field3');

}

So i am adding option based on the value selection .And each Sample1 and Sample2 as mandatory an it include None .

If i am selecting option from sample1 its taking values based on my selection in sample2 but   if i give none in sample1 its not selecting None in sample2 instead its coming as blank field. Due to that mandatory is not happening. Anyone has any suggestion?

Thanks

6 REPLIES 6

Frank
Mega Expert

I believe the value for none in a client script is an empty string "". Try if (Sample1 == '') and you should use a UI Policy to make Sample2 read only if Sample1 is none, this will force the user to answer the questions in the correct order.


Hi Frank,


Client wants that field to be enter.they don't want to make the field read only.. I think it is something index issue.but I am not clear about it.its happening in service portal.