How to use startWith() .

chandan31
Tera Contributor

Hi All,

 

var wsOptions4 = 'BR';
 var identifer = g_form.getValue('current_shift_identifier');
 if (wsOptions4.indexOf(identifer) >= 0) {
 g_form.setVisiable('test');
}
 
I want to use startWith() to search starting BR in the identifier 'var', can you guide me how to write the script.
 
 
Thanks,
Chandan

Jaspal Singh
Mega Patron

Hi Chandan,

You can try below

 

 

var wsOptions4 = 'BR';
 var identifer = g_form.getValue('current_shift_identifier');
 if (identifer.substring(0,2)==wsOptions4) {
 g_form.setVisible('test',true);//true,false to show/hide
}

 

 

Not Working , I am working in HRSD module (scoped application)

Strange. Can you confirm the alerts you get when using below code.

var wsOptions4 = 'BR';
 var identifer = g_form.getValue('current_shift_identifier');
alert('Identifier'+identifer);
 if (identifer.substring(0,2)==wsOptions4) {
alert('inside loop');
 g_form.setVisible('test',true);//true,false to show/hide
}

it is working  if  var wsOptions4 = 'BR, SF,GI',  is there  than who to use .

 

 

Can you guide me