Display associated states field based on country selection.

rohitreddy
Tera Contributor

I have two fields on catalog form, state and country. Both are referring to different tables and states record has a field referring to country table.

So when we select a country then its associated states values should be visible in the states dropdown field.

 

How to achieve this ?

1 ACCEPTED SOLUTION

Amit Verma
Kilo Patron
Kilo Patron

Hi @rohitreddy 

 

Assuming you have two lookup select box variables for Country and State respectively, you need to make use of the below Advanced Reference Qualifier in the State field to populate State based on country :

 

AmitVerma_0-1724214499107.png

 

javascript:"country="+current.variables.country.getDisplayValue(); //Assuming country is the name of the Country variable.

 

Output :

AmitVerma_1-1724214499239.png

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

View solution in original post

3 REPLIES 3

Amit Verma
Kilo Patron
Kilo Patron

Hi @rohitreddy 

 

Assuming you have two lookup select box variables for Country and State respectively, you need to make use of the below Advanced Reference Qualifier in the State field to populate State based on country :

 

AmitVerma_0-1724214499107.png

 

javascript:"country="+current.variables.country.getDisplayValue(); //Assuming country is the name of the Country variable.

 

Output :

AmitVerma_1-1724214499239.png

 

Thanks and Regards

Amit Verma


Please mark this response as correct and helpful if it assisted you with your question.

rohitreddy
Tera Contributor

Hi @Amit Verma ,

 

I tried with your solution but this did not work. Please see the snap attached;

javascript:"country="+current.variables.u_country.getDisplayValue();

 

country field on the catalog form is of Reference type.

 

u_country is backend name of country field on state table

 

 

Hi @Amit Verma ,

 

I tried below and it worked.

 

javascript: "u_country=" + current.variables.country;

 

Thank you for your suggestion.