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

Autopopulate blank data to a text field from a drop down list

Engaged ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

I entered the script below which works but not perfectly.  If COT or POT is picked from the drop down list I want the WO text field to be blank, which it does.  If 'Vacation' is picked the WO number "3071070" populates to the text field.  The problem is if the user changes their mind from Vacation to COT the WO number does not disappear.  Is there something I can put in the quotes to tell it I actually want a blank text field?  Thank you!!

// Place Absence Data into Pay Type Description and WO Fields

var AbsenceData = { "Vacation":{WO: "3071070",

PayTypeDesc: "Vacation" }, 

"COT":{ WO: "",

PayTypeDesc: "COT" }, 

"POT":{ WO: "",

PayTypeDesc: "POT" }, 

"Stat Holiday":{ WO: "3071070",

PayTypeDesc: "Stat Holiday" }, 

"Sick":{ WO: "3071080",

PayTypeDesc: "Sick" }, 

"Family Sick":{ WO: "3071080",

PayTypeDesc: "Family Sick" }, 

"Sick No Pay":{ WO: "3071080",

PayTypeDesc: "Sick No Pay" },                                                 

"Leave No Pay":{ WO: "3071080",

PayTypeDesc: "Leave No Pay" },                                                 

"Compassion Leave":{ WO: "3071080",

PayTypeDesc: "Compassion Leave" },                                                 

"WCB Hours":{ WO: "3071080",

PayTypeDesc: "WCB Hours" },                                                 

"WCB Sick Leave":{ WO: "3071080",

PayTypeDesc: "WCB Sick Leave" },                                                 

"Jury Duty":{ WO: "3071080",                

PayTypeDesc: "Jury Duty" },                                                 

"Union Leave":{ WO: "3071080",

PayTypeDesc: "Union Leave" }};                                                 

function SetFieldValuesAbsence1(cAbsenceName)

{

  this.getField("WO1").value = AbsenceData[cAbsenceName].WO;

  this.getField("PayTypeDesc1").value = AbsenceData[cAbsenceName].PayTypeDesc;

}

TOPICS
Acrobat SDK and JavaScript

Views

209

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
Community Expert ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

The way you have it set up should work. Are you seeing any error messages in the JS Console?

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
Engaged ,
Aug 14, 2019 Aug 14, 2019

Copy link to clipboard

Copied

LATEST

Oh my gosh, I must have done something weird before because it didn’t work and now it does! Thanks so much for the reply Try67, you’ve been so helpful for me!

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