Expand my Community achievements bar.

Applications for the 2024-2025 Adobe Experience Manager Champion Program are open!

How does the value in dropdown change dynamically according to the checkbox input

Avatar

Level 1

Tre r 2 check box nd ly 1 dropdown..according 2 te checkbox te value in te dropdown should change....how 2 make it dynamic......

6 Replies

Avatar

Former Community Member

I do not understand your question ...can you rephrase it?

Paul

Avatar

Level 1

Hi paul..

   I have 1 textbox and 2 dropdowm.1 dropdown is  for gender and the other is for relationship.The text box is  for states, where the value should be entered.Based on the gender the relationship dropdown value should  change.I do have list of states in my arraylist.if the value entered in the text box matches wit the value in my arraylist the relation dropdown value should change.if it doesnt match, another list of relationship value should display.How can i do that by using java script.Here based on both ,the gender and the text box,  the dropdown value should change.

reagrds

abi

Avatar

Former Community Member

I am still not 100% sure how the state fits into this but I created a sample that shows how to adjust the DDlist based on the Gender value. The code is on the exit event of the Gender dropdown.

paul

Avatar

Level 1

Hi paul

   Thanks for your help but i want  to add few more relationship  like  Husband,  wife in that dropdown.If the gender is male, then relationship dropdown should have  wife but not husband and if its female it should have  husband but not wife.Inspite of this there is another text box where the states should be entered.Lets have like,only few states accept that husband ,wife relationship others not.So according to the states entered husband and wife realtionship should be shown or hidden.

Eg:lets take Northan America .There that relationship is not accepted.so if he enters male,both  the husband and wife  option in relationship dropdown should be hidded.I have a list of states which accepts that relationship.I kept that in an array but dont kno how to proceed .

Regards

Abi

Avatar

Former Community Member

I am still not sure I understand but I woudl think that you woudl be able to add another check in the if statement ...something like:

if (this.rawValue == "Male") && (state.rawValue == "myState"){

     do true code here

} else {

     do false code here

}

This is fine if there are only a few options available ...if there are lots of combinations then a Switch statement might be a better approach.

Paul

Avatar

Level 1

Hi Paul

   Thank u.Its working.

Regards

Abi