Copy link to clipboard
Copied
I built a form for work that contains a drop down list. Based off the drop down item chosen, I want specific descriptive text to auto-populate in a text field.
I wrote the JAVA script and got the first one to work, but I can't get the others to.
Here is what I have:
var SkillObserved = this.getField("SkillObserved").valueAsString;
var Expectation = this.getField("Expectation").valueAsString;
if (SkillObserved == "HEART") {
Expectation = "De-escalating tense situations requires all team members to use the HEART method. Regardless of order, all steps must be taken. This is important because HEART uses tools to engage with an upset guest in a way that promotes a positive experience. By doing this, we are aligning with the health system's recommendation for customer service.";
}
else if (SkillObserved == "Two Patient Identifiers") {
Expectation = "We expect all team members to utilize two distinct identifiers. It is important that two unique identifiers are selected and open-ended questions are utilized to obtain the response. This is to eliminate any safety events related to incorrect patient identification.";
}
else if (SkillObserved == "In Person Guest") {
Expecation = "All pharmacy staff must greet guests using our standard greeting. Standard greetings enhance reliability, professionalism, and service.";
}
else if (SkillObserved == "Incoming Call") {
Expectation = "All pharmacy staff must greet guests using our standard greeting. Standard greetings enhance reliability, professionalism, and service.";
}
esle{}
this.getField("Expectation").value = Expectation;
Copy link to clipboard
Copied
Some of values are not same in script as they are in dropdown field like:
in script you used "In Person Guest" while in field it's "In-Person Greeting"
same for "Incoming Call" while in field it's "Incoming Call Greeting" plus all of choices have export value and you have few errors in your script.
I would remove document level script and place this in dropdown field under validation tab -> 'Run a custom validation script':
var Expectation = this.getField("Expectation");
if (event.value == "HEART") {
Expectation.value = "De-escalating tense situations requires all team members to use the HEART method. Regardless of order, all steps must be taken. This is important because HEART uses tools to engage with an upset guest in a way that promotes a positive experience. By doing this, we are aligning with the health system's recommendation for customer service.";
}
else if (event.value == "Two Patient Identifiers") {
Expectation.value = "We expect all team members to utilize two distinct identifiers. It is important that two unique identifiers are selected and open-ended questions are utilized to obtain the response. This is to eliminate any safety events related to incorrect patient identification.";
}
else if (event.value == "In-Person Greeting" || event.value == "Incoming Call Greeting") {
Expectation.value = "All pharmacy staff must greet guests using our standard greeting. Standard greetings enhance reliability, professionalism, and service.";
}
else
Expectation.value = "";
Also in dropdown field properties under 'Options' tab, check 'Commit selected value immediately'.
Here is your file with changes made:
https://drive.google.com/file/d/1h-ODYkJ_7aRCW9YpmkuY_UpH9pcwdN26/view?usp=share_link
Copy link to clipboard
Copied
This is by far one of the most (if not the most) asked question on the forum. See these forum threads.
Copy link to clipboard
Copied
Thank you, Thom. I looked through the thread. Tried several of the "solves" and none of them worked for me. I'm sure it's user error, but any personalized help is greatly appreciate.
On a more "user friendly note". Maybe you Adobe could do everyone a solid and build a JAVA SCRIPT wizard in Acrobat for situations like this.
Copy link to clipboard
Copied
Some of values are not same in script as they are in dropdown field like:
in script you used "In Person Guest" while in field it's "In-Person Greeting"
same for "Incoming Call" while in field it's "Incoming Call Greeting" plus all of choices have export value and you have few errors in your script.
I would remove document level script and place this in dropdown field under validation tab -> 'Run a custom validation script':
var Expectation = this.getField("Expectation");
if (event.value == "HEART") {
Expectation.value = "De-escalating tense situations requires all team members to use the HEART method. Regardless of order, all steps must be taken. This is important because HEART uses tools to engage with an upset guest in a way that promotes a positive experience. By doing this, we are aligning with the health system's recommendation for customer service.";
}
else if (event.value == "Two Patient Identifiers") {
Expectation.value = "We expect all team members to utilize two distinct identifiers. It is important that two unique identifiers are selected and open-ended questions are utilized to obtain the response. This is to eliminate any safety events related to incorrect patient identification.";
}
else if (event.value == "In-Person Greeting" || event.value == "Incoming Call Greeting") {
Expectation.value = "All pharmacy staff must greet guests using our standard greeting. Standard greetings enhance reliability, professionalism, and service.";
}
else
Expectation.value = "";
Also in dropdown field properties under 'Options' tab, check 'Commit selected value immediately'.
Here is your file with changes made:
https://drive.google.com/file/d/1h-ODYkJ_7aRCW9YpmkuY_UpH9pcwdN26/view?usp=share_link
Copy link to clipboard
Copied
Thank you, Nesa!
I saw your response on another post about validating the field and used it and it worked beautifully! I appreciate your time!
Copy link to clipboard
Copied
Check the JavaScript console for errors.
Where does you use the script?
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more