Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

check if the rawvalue contains "TW"

Avatar

Level 2
I have a Dropdown list called A with the following possibilities:

G

GTW

GLTW

SC

SCTW

E

ETW

and so maybe 30 more options



is it possible to check (with javascript) if the rawvalue contains "TW" because then I have to hide some subforms and show one other subform.



Can someone please help me?
1 Reply

Avatar

Level 5
try the following in Change event of the Dropdown



var curSelection = xfa.event.change;



if (Right(curSelection, 2) == "TW") {

//use your code to hide and visibility

}



function Right(str, n){

if (n <= 0)

return "";

else if (n > String(str).length)

return str;

else {

var iLen = String(str).length;

return String(str).substring(iLen, iLen - n);

}

}