Expand my Community achievements bar.

match a field to a list of values

Avatar

Level 1

Hi, I need to to display a field only if the Supplier number matching on in a list of values

 

 

some like 

 

if(FormPurchaseOrderRequest.frmShipAndBill.frmInfoBlock.txtSupplierID matches on of these values ('Y78DC','4568','PEN_V7','PNX_45','DC567'))
   then
       this.presence = "visible";
   else
       this.presence = "hidden";
   endif

1 Reply

Avatar

Level 10

Hi,

 

the best way it to check the input against an array of value.

var aList = ['Y78DC','4568','PEN_V7','PNX_45','DC567'],
    cInput = txtSupplierID.rawVaue, 
    bMatch = aList.some(function (cValue) {return cValue == cInput;});
this.presence = bMatch ? "visible" : "hidden";