Skip to main content
Inspiring
August 14, 2019
Question

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

  • August 14, 2019
  • 1 reply
  • 366 views

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;

}

This topic has been closed for replies.

1 reply

try67
Adobe Expert
August 14, 2019

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

Inspiring
August 14, 2019

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!