Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Trouble with presence visible/hidden script

Avatar

Level 2

This is my first post on this forum. I have tried to figure this out on my own, but no solution.

I am creating a PDF with LiveCycle Designer ES v 8.2. and trying to a show state dropdown list if US is selected and province dropdown list if Canada is selected using an "if, else if" statement.

My form opens with both dropdown lists hidden and I want to show a picklist only if United States or Canada is chosen.

Here is my script for when the Country is chosen from the dropdown box. Can anyone figure out what is happening?  The dropdown list field names are:

     cboCo_Name_Country

     cboCo_Name_State

     cboCo_Name_ProvinceI

PROBLEM: No matter which country I choose, it always go to the final else statement where both are hidden. I know this because in trouble-shooting I made combo boxes initially visible and no matter what country I chose, both fields became hidden.

form1.sf_Page_1.sf_CompInfo.sf_CustAddress.cboCo_Name_Country::change - (JavaScript, client)

// Change the presence attribute of the state and province fields.

if (this.rawValue == "United States") {                    // If country selected is US, 
    cboCo_Name_State.presence = "visible";          // show US States field,   
    cboCo_Name_Province.presence = "hidden";     // and hide Provinces field. 
   
}
else if (this.rawValue == "Canada") {                        // If country selected is Canada,
    cboCo_Name_Province.presence = "visible";        // show Provinces field,
    cboCo_Name_State.presence = "hidden";            // and hide US States field.
   
}
else {                                                                      // Otherwise, if any other country is selected  
    cboCo_Name_State.presence = "hidden";              // hide US States field,
    cboCo_Name_Province.presence = "hidden";          // and hide Provinces field. 
   
}

Any help is appreciated.

1 Accepted Solution

Avatar

Correct answer by
Level 2

I found the problem. The rawValues needed to be US and CA, and not "United States" and "Canada". I found it on the binding tab.

View solution in original post

1 Reply

Avatar

Correct answer by
Level 2

I found the problem. The rawValues needed to be US and CA, and not "United States" and "Canada". I found it on the binding tab.