drop-down list formattedValue returning value, not text

Avatar

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile

Avatar
Boost 1
Level 4
Thomas_McConnac
Level 4

Likes

2 likes

Total Posts

134 posts

Correct reply

0 solutions
Top badges earned
Boost 1
View profile
Thomas_McConnac
Level 4

20-02-2009

Hi all,



I'm having a problem with a drop-down list. I can get the information I want in Reader 9, but we only have Reader 7.0.5 distributed at the moment.



I need to pull out its text value and its specified value, but everything I try just pulls out the specified value.



In Reader 9 formattedValue gives me the text and rawValue will give me the specified value.



Anyone able to help me please?



Thanks,



Tom

Replies

Avatar

Avatar
Affirm 3
Level 2
JohnBrinkman
Level 2

Likes

0 likes

Total Posts

20 posts

Correct reply

3 solutions
Top badges earned
Affirm 3
Affirm 1
View profile

Avatar
Affirm 3
Level 2
JohnBrinkman
Level 2

Likes

0 likes

Total Posts

20 posts

Correct reply

3 solutions
Top badges earned
Affirm 3
Affirm 1
View profile
JohnBrinkman
Level 2

25-02-2009

Tom:



It's possible, but complicated. You need to look into the field definition where we store the listbox contents. Then you can correlate the display item from the bound item. I've done this before in another context. I've appended the script I used.



John Brinkman

http://blogs.adobe.com/formfeed



function getDisplayValue(vField)

{

var vBoundItems = saveItems(vField);

var vDisplayItems = dispItems(vField);



if (vBoundItems == null || vDisplayItems == null)

return vField.rawValue;



for (var i=0; i<vBoundItems.length; i++)

{

if (vBoundItems.item(i).value == A.rawValue)

return vDisplayItems.item(i).value;

}

return "";

}

/*

* saveItems(vField)

* Get the list of items that are bound to the data

* @param vField -- the list field

*/

function saveItems(vField)

{

for (var i=0; i<vField.nodes.length; i++)

{

var vChild = vField.nodes.item(i);

if (vChild.className == "items" && vChild.save == "1")

return vChild.nodes;

}

return null;

}



/*

* dispItems(vField)

* Get the list of display items

* @param vField -- the list field

*/

function dispItems(vField)

{

/*

<items>

<text>aaa</text>

</items>

<items save="1" presence="hidden">

<text>111</text>

</items>

*/

for (var i=0; i<vField.nodes.length; i++)

{

var vChild = vField.nodes.item(i);

if (vChild.className == "items" && vChild.save != "1")

return vChild.nodes;

}

return null;

}