How to script a contains condition in client script?

E_19
Giga Expert

Hi All,

I have having trouble scripting a condition that will check if my value contains a certain value.

This is on incident and the field to check is reference Company name field from core_company table.

I have retrieved the value using Ajax call and now I want to check if it contains a value like Dutch Re

if(g_form.getValue('gr.name') ????? 'Dutch Re')

I have read upon using indexOf but may attempts trying to use it failed. Idea is if IndexOf finds < -1 it should indicate the value is there

and then I want to show or hide section tabs.

If anyone can advise or have another suggestion that be greart.

Thanks

Ellie

1 ACCEPTED SOLUTION

sujalavemula
Kilo Guru

and correct the condition to       ---     if(g_form.getValue('gr. name').indexOf('Dutch Re') > -1)


View solution in original post

6 REPLIES 6

sujalavemula
Kilo Guru

and correct the condition to       ---     if(g_form.getValue('gr. name').indexOf('Dutch Re') > -1)


Thank you very much Sujala is working now