Skip to main content
Participant
February 16, 2023
Question

Adress fields being populated based on chosen dropdown field

  • February 16, 2023
  • 1 reply
  • 1597 views

Hi friends,

 

can someone please help with this task:

 

I need to print the envelopes with different addresses based on chosen Target adresee in dropdown field /choose only one/. Adress should be then printed on A5 envelope.

 

For example: Dropdown Field named menu lists Paris, Berlin,Amsterdam, Bratislava,... and based on that I need fields in addres be populated with different text.

 

So the Dropdown Field would be for example: Name1,Name2,Name3,...

 

Adress line would be fillled like: 

Name Surname /textfield populated based on Name dropdown selection/

Street /textfield populated based on Name dropdown selection/

City /textfield populated based on Name dropdown selection/

Postal code /textfield populated based on Name dropdown selection/

Country /textfield populated based on Name dropdown selection/

 

Thank youvery much for your help

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
February 16, 2023

As 'Validate' script of dropdown field, use this (just fill in your info):

var name = this.getField("Name Surname");
var street = this.getField("Street");
var city = this.getField("City");
var postal = this.getField("Postal code");
var country = this.getField("Country");

switch(event.value){
case "Name1":
name.value = "some name1";
street.value = "some street1";
city.value = "some city1";
postal.value = "some postal code1";
country.value = "some country1";
break;

case "Name2":
name.value = "some name2";
street.value = "some street2";
city.value = "some city2";
postal.value = "some postal code2";
country.value = "some country2";
break;

case "Name3":
name.value = "some name3";
street.value = "some street3";
city.value = "some city3";
postal.value = "some postal code3";
country.value = "some country3";
break;

default:
name.value = "";
street.value = "";
city.value = "";
postal.value = "";
country.value = "";}

 

Participant
February 22, 2023

Sorry for dely. Thank you very much. So if I understand clearly, after I paste this into validate,I should also create text field and there create "count" script event.value = name; event value=strett, and so on?

Nesa Nurani
Community Expert
Community Expert
February 22, 2023

No, from your post I assumed you have fields for each part you wish to populate, or you wish to populate all data inside one field?