UI Policy Case Insensitive Match

rhyno1
Giga Contributor

Hello,

I have a UI policy that I want fired when a field called "colour" is equal to the value "White". However I want this match to be case insensitive. So the field could be "white", "White" or "WHite" and so on. I'm just wondering how I would do this?

I tried using a regex expression match and used the expression: [Wh][Ii][Tt][Ee]

But this did not work.

Regards,

Rhyno

Edit:

Originally I implemented this with client script. I was hoping to achieve this without any client scripts and just use UI Policies if this is possible.

3 REPLIES 3

Vinobalu
Kilo Expert

Hi,



Use onChange client script.



var s = g_form.getValue('color');


if(s.toLowerCase() == 'white')


      {


                           


      }


rhyno1
Giga Contributor

Hey Vinobalu,


Thanks for the response. I have written the same script before but I was hoping to do this without client script if possible?


Is is possible to achieve this with UI policies alone?


gowrisankarsati
Mega Contributor

Hi,



You can try using the following code :



var r = new RegExp("white", "i");


var result = r.test('WhiTe');



Please Refer the Follow link for the more Info :


RegExp.prototype.ignoreCase - JavaScript | MDN



Thanks,


Gowri Sankar.