• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
7

Populating Company names based of of contract numbers

Explorer ,
Feb 29, 2024 Feb 29, 2024

Copy link to clipboard

Copied

Can someone teach me what is wrong with this script? It says there's an unterminated string literal on line 3. When a user enters a contract number in Field1, I want the form to populate the name of the company the contract is tied to in the field this script is in.

 

var f = this.getField("Field1")

if(event.value == "Contract Number”)

f.value = "Company Name";

else
{
// do nothing
}

TOPICS
JavaScript , PDF , PDF forms

Views

3.9K

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
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Mar 01, 2024 Mar 01, 2024

Copy link to clipboard

Copied

Use this:

 

var f = this.getField("Field1")
if (event.value == "Contract Number1") {
	f.value = "Company Name1";
} else if (event.value == "Contract Number2") {
	f.value = "Company Name2";
} else {
	// do nothing
}

View solution in original post

Votes

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
community guidelines
Explorer ,
Mar 06, 2024 Mar 06, 2024

Copy link to clipboard

Copied

LATEST

Perfect! Thank you for your help! I just wish I knew what was wrong with my copy.

Votes

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
community guidelines