So, I am dealing with the following.
I create a PDF file and let the user fill in the fields. One of the fields is a list. After selection, other fields are filled with the fitting.
This content is stored in an array.
So here is what I did:
var company = ["comapny name", "street", "Postcode", "City", "Country"];
var company1 = ["comapny name1", "street1", "Postcode1", "City1", "Country1"];
if (!event.willCommit){
if (listCompany.value == "comapny name"){
this.getField("fldStreet").value = company[2];
}
if (listCompany.value == "comapny name1"){
this.getField("fldStreet").value = company1[2];
}
}
The above part does not give an error, but gives me the "previous" content.
Download PDF and fill in the fields. After changing the list, the fields will not change their content. Only after the second click.
So, I found the following:
event.changeEx;
After a simple attempt, it works fine:
var company = ["comapny name", "street", "Postcode", "City", "Country"];
var company1 = ["comapny name1", "street1", "Postcode1", "City1", "Country1"];
if (!event.willCommit){
if (listCompany.value == "comapny name"){
this.getField("fldStreet").value = event.changeEx;
}
if (listCompany.value == "comapny name1"){
this.getField("fldStreet").value = event.changeEx;
}
}
This gives me the value of the selected item. But the problem that I am currently facing is to select other fields from my array based on the selection.