I have developed a list of variable that are actually peoples names. The value I assigned to each is their contact information. When their name is selected from a dropdownlist, I would like their contact info to appear in a text field below the dropdown list box.
Does anyone have a sample of how to do this or insight on this.
Thanks in advance,
Paul
Views
Replies
Total Likes
I have a form with a drop-down list called 'dropDown' and a text field called 'textField'. On the drop-down change event call the calculate event on 'textField' as follows:
// form1.page1.subform1.dropDown::change - (JavaScript, client)
form1.page1.subform1.textField.execEvent("calculate");
On the text field calculate event add the script below.
// form1.page1.subform1.textField::calculate - (JavaScript, client)
this.rawValue = xfa.event.newText;
Steve
Views
Replies
Total Likes
If you have multiple contacts, a switch statement might be a good choice. In this example, I used nameList for the drop down list containing the names and text as the name of the field being populated with contact info.
switch
(nameList.rawValue)
{
case "John Smith":
text.rawValue
= "32 West Lane Some City Some Zip Code";
break;
case "Joe Brown":
text.rawValue
= "33 West Lane Some City Some Zip Code";
break;
case "Bill Jones":
text.rawValue
= "34 West Lane Some City Some Zip Code";
break;
default:
}
Views
Replies
Total Likes
How does this call the variable set
in the form properties
under the variable tab?
Thanks
Paul
Views
Replies
Total Likes
The same way you would call them for the drop-down list; maybe I misunderstood, are you not already populating the drop-down list with your variables?
Views
Replies
Total Likes
For your drop-down list, let's say you have a global variable called pf with a value of PFrigo1. In your drop-down list on the initialize event you would script:
dropdownlist1.addItem(pf.value);
Views
Replies
Total Likes
The choices listed in the drop down list have values set through the form properties. Please see the screen shot:
When you select the persons name from the drop down, the text field will populate with the value defined for that particular variable.
I hope this makes sense.
Views
Replies
Total Likes
Ok, so the drop-down list has a list of names in it already, right? In that case you could try this:
switch(nameList.rawValue)
{
case "John Smith":
text.rawValue= John.value;
break;
case "Paul Brown":
text.rawValue= Paul.value;
break;
default:
}
The reference for the global variables is variablename.value.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies