Highlighted

How to pupolate one text field from multiple drop down list

New Here ,
Sep 03, 2020

Copy link to clipboard

Copied

Hello all! I am trying to help my sales team by doing a part of the job for them.

We did a PDF with different drop down lists, which can be used to create a buying code. 

So, as an exemple, they choose these option from the different drop down menus:

Car

Blue

3in

Mags

I would like that the text file to put the infos like that:

Car-Blue-3in-Mags

 

I first did it with individual text box side-by-side and the "event.value = this.getField("Car").value;" script but my problem is that some of the choices are "optional" and that I could get gaps in my line.

Is there a script who can do the same job but all in one text box?

Thanks for your help

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes. Use the following code as the custom calculation script of your text field:

 

var fields = ["Car", "Blue", "3in", "Mags"];
var values = [];
for (var i in fields) {
	var f = this.getField(fields[i]);
	if (f.valueAsString!=f.defaultValue) values.push(f.valueAsString);
}
event.value = values.join("-");
TOPICS
PDF forms

Views

38

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to pupolate one text field from multiple drop down list

New Here ,
Sep 03, 2020

Copy link to clipboard

Copied

Hello all! I am trying to help my sales team by doing a part of the job for them.

We did a PDF with different drop down lists, which can be used to create a buying code. 

So, as an exemple, they choose these option from the different drop down menus:

Car

Blue

3in

Mags

I would like that the text file to put the infos like that:

Car-Blue-3in-Mags

 

I first did it with individual text box side-by-side and the "event.value = this.getField("Car").value;" script but my problem is that some of the choices are "optional" and that I could get gaps in my line.

Is there a script who can do the same job but all in one text box?

Thanks for your help

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

Yes. Use the following code as the custom calculation script of your text field:

 

var fields = ["Car", "Blue", "3in", "Mags"];
var values = [];
for (var i in fields) {
	var f = this.getField(fields[i]);
	if (f.valueAsString!=f.defaultValue) values.push(f.valueAsString);
}
event.value = values.join("-");
TOPICS
PDF forms

Views

39

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 03, 2020 0
Most Valuable Participant ,
Sep 03, 2020

Copy link to clipboard

Copied

Yes. Use the following code as the custom calculation script of your text field:

 

var fields = ["Car", "Blue", "3in", "Mags"];
var values = [];
for (var i in fields) {
	var f = this.getField(fields[i]);
	if (f.valueAsString!=f.defaultValue) values.push(f.valueAsString);
}
event.value = values.join("-");

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 03, 2020 0
LilSo LATEST
New Here ,
Sep 04, 2020

Copy link to clipboard

Copied

Wow!!! This work perfectely! Thanks a lot for your help!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 04, 2020 0