cancel
Showing results for 
Search instead for 
Did you mean: 

Access to Data from Javascript

Former Member
0 Kudos

I have a propertie call it "country" in my "Data View" and I need access its value from javascript code to use in a IF sentence.

I try thinks such as "xfa.node.getAttribute("country")" but doens't work.

How can I access it?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

NoJo
Active Participant
0 Kudos

--> get values from the data view if you don't have them in your form (hierarchy) -->

in javascript: xfa.record is access to the upper node in your dataview (the name of your form in most cases)

dataview:

-Formname

--structure1

---field1

access field1 --> xfa.record.structure1.field1.rawValue

Former Member
0 Kudos

Hi Sebastian,

U ll hv Country drop down list in the library (in the Form Builder).. drag and drop that one.. it ll hv the countries and its index value by default. Use the index in the javascript *if statement*.

regards,

*Surya*

Answers (1)

Answers (1)

chintan_virani
Active Contributor
0 Kudos

You can try like this:-

if(country.rawValue == "IN")
{
   xfa.host.messageBox ("You selected India");  // This will display a pop-up
}
else
{
   xfa.host.messageBox ("You selected some other country");
}

Chintan

Former Member
0 Kudos

Variable "country" doen's exists