Populate drop down value depending on previous drop down selection

ishanishah

13-05-2020

I have a requirement to populate a drop down depending on a value chosen from a previous drop down list in an Input form.

Let's say there are 2 drop downs - product group and sport name in the nms:operation table.

I have created 4 enumerations in the data schema: 

Product group= A, B, C.

sport Name A = A1. A2, A3

Sport Name B= B1, B2, B3

Sport Name C= C1, C2, C3

Depending on what is selected in product group, the sport name field should be populated with the relevant enum values.

If product group is A - I should get A1, A2 and A3 in the sport name drop down list.

If product group is B - I should get B1, B2 and B3 in the sport name drop down list.

If product group is C - I should get C1, C2 and C3 in the sport name drop down list.

In the nms:operation Input form I used the below code:

 
 

<container label="Reporting" name="cusReporting">
<container type="notebook">
<container colspan="2" label="General">
<container colcount="2" label="General" type="frame">
<input xpath="@productGroup"/>

<container visibleIf="@productGroup='A'" type="visibleGroup">
<input enum="sportNameA" type="sysenum" xpath="@sportName"/>
</container>

<container visibleIf="@productGroup='B'" type="visibleGroup">
<input enum="sportNameB" type="sysenum" xpath="@sportName"/>
</container>

<container visibleIf="@productGroup='C'" type="visibleGroup">
<input enum="sportNameC" type="sysenum" xpath="@sportName"/>
</container>

</container>
</container>
</container>
</container>

 

With this, I am able to populate the sportName enum values correctly in drop down for example when I select product group = 'A' , I see A1, A2 , A3 in sport name drop down. but when I select a different value in product group for ex. 'B' it gives the following error:

Value 'A2' is not valid for enumeration 'sportNameB (nms:operation:sportNameB)'.

I also tried using "If" expression in the form but unable to get rid of the error.

Can someone advise?

@Amit_Kumar 

@Vapsy 

@pablo_rosero1 

 

Adobe Campaign Classic enumeration Input Form
View Entire Topic

Jyoti_Y

MVP

03-06-2020

Hi,

 

Instead of using 'onClick' use 'onChange' function.

 

Use below code, it should work:

<input choiceButton="true" xpath="@productGroup">
<enter name="onChange">
<set value="0" xpath="@sportName"/>
<reset xpath="@sportName"/>
</enter>
</input>

 

Also, in your schema definition, you are defining product as attribute, revCardinality and integrity is not required. Those parameters are used when you define element.

 

Thanks.