Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

How to change the values of dropdown with two columns - offline form?

GVR
Level 1
Level 1

I am creating a offline Adobe interactive form.

I have two fields in a table :-:       Course Number and Course Name. 

I have a dropdown on Course Name (since users mostly know Course name)

This dropdown gets filled via a webservice (WS1) call to SAP in the form ready event

The webservice returns a table with two fields - CTEXT and CID.

I bound this Web service data connection to the Dynamic properties of Course name dropdown with CTEXT bound to "Item Text" and CID bound to "item Value" fields.

So when I choose the Course Name from dropdown , I can see the name in the CTEXT field (available against xfa.event.newtext propety).

In the exit event of the CTEXT field, I am able to pass the value to the CID as

this.parent.CID.rawValue = this.rawValue.          <------------ @1

So far so good.

I had to improve upon this a bit - like - when I input the CID, I have to get the Course Name.

So I called another web service (WS2) in the "exit" event of the CID field and it is fetching the Course name properly (WSTEXT) - I am able to store this in a text field.

and tried to pass the value to CTEXT as

this parent.CTEXT.rawValue = WSTEXT.rawValue

But this is overwriting the CID value because of the code @1

Can you please provide me code / syntax

1. To update the value of the CTEXT field based on the CID value (webservice WS2 call returns the CTEXT value)

2. Add the CID and CTEXT values to the CTEXT dropdown

3. while doing so, delete duplicates from CTEXT dropdown

Thanks,

GVR

4 Replies
GVR
Level 1
Level 1

using additem - I am able to achieve upto

1. To update the value of the CTEXT field based on the CID value (webservice WS2 call returns the CTEXT value)

2. Add the CID and CTEXT values to the CTEXT dropdown

Since I wrote my code on EXIT event, whenever I tab out a new line is added to the dropdown.

It is thus adding duplicates into the dropdown.

Now the question

How to delete duplicates from CTEXT dropdown?

GVR
Level 1
Level 1

I think if I am able to read the dropdown - this issue can be resolved.

So I am struggling to read the dropdown which is mapped to a WebService connection to CTEXT field as below - in the "Specify Item Values":

!connectionData.FetchCourseType.Body.ZFETCHCOURSETYPEResponse.ZCOURSETYPES.item[*]

How to read this data in the TAB event of CID field?

Please advise

Thanks

GVR
Level 1
Level 1

Solved by using the following code

var particulars = this.parent.COURSENAME.resolveNode("#items"); 

this will bring the dropdown list into the variable particulars

then


for (var i = 1; i < particulars.nodes.length; i++)
{
p = particulars.nodes.item(i);

here p.value will have the dropdown line by line;
add your valdiations etc
}

GVR
Level 1
Level 1

The code above did help me figure out the p.value - but it is always bringing the first entry - I need to somehow get the numeric value bound against p.value and compare in the loop and finally get the correct p.value.

Can you please advise?

Thanks