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

Dropdown values not proper in the generated XML after filling the form

Avatar

Former Community Member

hi

I have a form which has dropdowns populating from an XML file, the dropdown elements has a text and value associated with it.

The problem is when i generate the xml of the form the value tags are coming in it instead of the text in the dropdown.

Pls help. how can i get the text of the selected dropdown value in the XML?

Thanks

Abhiram

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

I would recommend going to the Object > Binding palette and deselecting the "Specify values". This way the display values will be included in the XML, as the display value will be the same as the .rawValue of the dropdown.

However this means that any script referencing the dropdowns will have to use the display values for the items and not the previous bound values.

Hope that helps,

Niall

View solution in original post

4 Replies

Avatar

Correct answer by
Level 10

Hi,

I would recommend going to the Object > Binding palette and deselecting the "Specify values". This way the display values will be included in the XML, as the display value will be the same as the .rawValue of the dropdown.

However this means that any script referencing the dropdowns will have to use the display values for the items and not the previous bound values.

Hope that helps,

Niall

Avatar

Former Community Member

Hi

Yes its working for the dropdowns for which values are specified manually but here in this case the values are populating from the XML file.

I will just explain my case.

Here is my xml file which i have included as a data file in the preview tab, because my form is already binded with an XSD.

<?xml version="1.0" encoding="UTF-8"?>
<VCF xmlns="http://tempuri.org/VCF.xsd">

<States>
<item uiname="Andhra Pradesh" token="IN1"/>
<item uiname="Maharastra" token="IN2"/>
<item uiname="Tamilnadu" token="IN3"/>
</States>

<IN1>
<item uiname="Hyderabad" token="IN11"/>
<item uiname="Visakhapatnam" token="IN12"/>
</IN1>
<IN2>
<item uiname="Mumbai" token="IN21"/>
<item uiname="Pune" token="IN22"/>
</IN2>
<IN3>
<item uiname="Chennai" token="IN31"/>
<item uiname="Vellore" token="IN32"/>
</IN3>

</VCF>

In the Designer i have a state dropdown filed, by clicking Field->list items

Items:$record.States.item[*]

Item Text:uiname

Item Value:token

Also i have deselected the specify item values.

And in the Change event of the state dropdown, I have written below code to populate the city dropdown field

function stateChange(state,city)
{
var tempString = "xfa.record." + state.boundItem(xfa.event.newText);

var oItems = xfa.resolveNode(tempString);
var nItemsLength = oItems.nodes.length;
city.mandatory="";
city.clearItems();
city.rawValue = null;

for (var nItemCount = 0; nItemCount < nItemsLength; nItemCount++)


city.addItem(oItems.nodes.item(nItemCount).uiname.value,oItems.nodes.item(nItemCount).token.value);
}
city.validate.nullTest = "error";
}

Now in the generated XML, I am getting the token values instead of the display values.

Pls help.

Thanks

Abhiram

Avatar

Former Community Member

Hi,

Don't know if this is much help. I have done something very similar to this in the past, but all my XML values were in elements. I notice that you are trying to fish the values out of attributes.

regards,

Gordon

Avatar

Former Community Member

Yes. I have given tokens inorder to use them again in the tags so that i can get the desired city based on the state selected.