Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Scripts not working right

Avatar

Level 4
Hi All,

I have written the below code, and placed it on the exit event of a drop down list on a form that I am working on. The script works some times, and sometimes, it does'nt work right.
I do not know why it is not working right all the times. I need help with possibly what I may be missing.

if
(ReasubdrpdwnList1.rawValue=="Annual"){

   ReasonFor.rawValue="2";

   }

if(ReasubdrpdwnList1.rawValue=="Change of Rater"){

        ReasonFor.rawValue="03";

   }

if(ReasubdrpdwnList1.rawValue=="Change of Duty"){

   ReasonFor.rawValue="04";

   }

if(ReasubdrpdwnList1.rawValue=="PCS"){

   ReasonFor.rawValue="04";

   }

if(ReasubdrpdwnList1.rawValue=="REFRAD"){

   ReasonFor.rawValue="04";

   }

if(ReasubdrpdwnList1.rawValue=="Retirement"){

   ReasonFor.rawValue="04";

   }

if(ReasubdrpdwnList1.rawValue=="Discharge"){

   ReasonFor.rawValue="04";

   }

if(ReasubdrpdwnList1.rawValue=="Reassignment"){

   ReasonFor.rawValue="04";

   }

if(ReasubdrpdwnList1.rawValue=="Relief for cause"){

   ReasonFor.rawValue="05";

   }

if(ReasubdrpdwnList1.rawValue=="Depart TDY"){

   ReasonFor.rawValue="06";

   }

if(ReasubdrpdwnList1.rawValue=="60 day opt"){

   ReasonFor.rawValue="07";

   }

if(ReasubdrpdwnList1.rawValue=="SR option"){

   ReasonFor.rawValue="08";

   }

if(ReasubdrpdwnList1.rawValue=="Complete Rec"){

   ReasonFor.rawValue="09";

   }

if(ReasubdrpdwnList1.rawValue=="Ext annual"){

   ReasonFor.rawValue="10";

   }

if(ReasubdrpdwnList1.rawValue=="Promotion"){

   ReasonFor.rawValue="11";

   }

if(ReasubdrpdwnList1.rawValue=="REFRAD (USAR/ARNG ONLY)"){

   ReasonFor.rawValue="12";

   } 

if(ReasubdrpdwnList1.rawValue=="REFRAT"){

   ReasonFor.rawValue="12";

   }

if(ReasubdrpdwnList1.rawValue=="REFRADOS-RC"){

   ReasonFor.rawValue="12";

   }

if(ReasubdrpdwnList1.rawValue=="REFRADOS"){

   ReasonFor.rawValue="12";

   }

if(ReasubdrpdwnList1.rawValue=="REFRCO-AD"){

   ReasonFor.rawValue="12";

   }

Thanks

v/r

Tammy         

1 Accepted Solution

Avatar

Correct answer by
Level 5


V/r There is no problem with your script.Can you plz mention for which selection your script is failing.
I would suggest you to use Swtich statement instead of using many if loops.

Vjay

View solution in original post

2 Replies

Avatar

Level 2

Hi,

Could it be there are empty trailing spaces for your values? Try adding this before the start of all the 'if' statements :

xfa.host.messageBox("Selected value:" + ReasubdrpdwnList1.rawValue + ".");

Then notice if there are gaps between the selected value and the "." .

Hope this helps.

Regards,

Ber

Avatar

Correct answer by
Level 5


V/r There is no problem with your script.Can you plz mention for which selection your script is failing.
I would suggest you to use Swtich statement instead of using many if loops.

Vjay