Skip to main content
jamesf16495717
Participant
January 23, 2018
Answered

Autofill based on tick box selections

I'm very new to creating forms and have never used any Java Scripts, but I'm hoping that someone here can help me.

I have a kit that has a lot of configuration options. every time we send one of these to a customer we have to type out all the items included into a kitting list.

what I want to know is if/how I could have a page full of tick box selections that someone can go though and easily mark what is in the kit, that will then populate a list or text box?

Many thanks in advance!

This topic is closed to new replies. Start a new post to keep the conversation going.
Thom Parker
Thom ParkerCorrect answer
Community Expert
January 23, 2018

There are a couple of ways to do this. A multi-line text box with a calculation script is a good way to go.

Here's a very straight forward custom calculation script:

event.value = "";

if(this.getField("Checkbox1").value == "Yes")

  event.value += "Item 1\n";

if(this.getField("Checkbox2").value == "Yes")

  event.value += "Item 2\n";

You'll need to change out the checkbox names and the messages. The "\n" is a line feed, it's necessary to put each item on it's own line.

There are better ways to do this, but this is among the simplest.

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often

2 replies

Thom Parker
Community Expert
Thom ParkerCommunity ExpertCorrect answer
Community Expert
January 23, 2018

There are a couple of ways to do this. A multi-line text box with a calculation script is a good way to go.

Here's a very straight forward custom calculation script:

event.value = "";

if(this.getField("Checkbox1").value == "Yes")

  event.value += "Item 1\n";

if(this.getField("Checkbox2").value == "Yes")

  event.value += "Item 2\n";

You'll need to change out the checkbox names and the messages. The "\n" is a line feed, it's necessary to put each item on it's own line.

There are better ways to do this, but this is among the simplest.

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
jamesf16495717
Participant
January 23, 2018

Hi Thom,

I'll try this out, Thanks you!

Translate