Skip to main content
Participating Frequently
January 15, 2017
Question

fill textbox from other textbox based on combobox selection

  • January 15, 2017
  • 1 reply
  • 508 views

I would like to know if anyone can help me on the following problem?

However when i do this nothing happens. I have 2 forms in the document 1 with only textboxes (top) the other with 1 dropdownbox and 2 textboxes (bottom).

Name:  example-dropdown.jpg Views: 59 Size:  43.9 KB

My knowledge of Acrobare Pro Java is quite small. I think it should be something like this. However this doesn't work in Java.

Code:

If dropdownDoc1.text=DocumentnrTXT.text then TitleTXT.text=TextboxTitle1.text RevTXT.text=TextboxRev1.text else ....

The following code doesn't do exactly what i need.

This code is placed in the custom calculation script of the textbox i would like to fill.

Code:

if(this.getField("dropdownDoc").value == " ") { event.value = ""; } 
else if (this.getField("dropdownDoc").value == "DocumentnrTXT1")
{event.value = this.getField("TitleTXT1").valueasstring; }
else if (this.getField("dropdownDoc").value == "DocumentnrTXT2")
{event.value = this.getField("TitleTXT2").valuevalueasstring; }

The problem is that it show the value from the dropdownbox and not the textbox as i expected it to do.

This topic has been closed for replies.

1 reply

Inspiring
January 15, 2017

Are you using Acrobat or LiveCycle to create this form?

Are you getting any errors when you add the script to the form?

Have you checked the Acrobat JavaScript console for any errors when filling in the form?

Make sure you capitalize names, properties, methods, function names. etc. correctly. JavaScript is very case sensitive.

It appears the names of your fields are not the same as the field names being accessed.

Participating Frequently
January 15, 2017

Hi, thank you for the reply.

I'm using Acrobat Pro.

I'm not getting errors.

"It appears the names of your fields are not the same as the field names being accessed"

I use the name that is in the "general" tab is this not correct?

Selecting the dropdownbox changes the textbox. But it fills it with the same text as the dropdownbox while i expected it to fill with a text from the textbox (TitleTXT1).

if(this.getField("dropdownDoc").value == " ") { event.value = ""; }

else if (this.getField("dropdownDoc").value == "DocumentnrTXT1")

//if the dropdownbox value is equal to the DocumentnrTXT it needs to fill this textbox with the text from TitleTXT1.

//

{event.value = this.getField("TitleTXT1").value; }

//Event value is called and it get the field value from TitleTXT1 to fill it in the current textbox where this code is placed.

//

else if (this.getField("dropdownDoc").value == "DocumentnrTXT2")

{event.value = this.getField("TitleTXT2").value; }