How do I write Java to populate TEXT in a field based off a chosen item in a drop down menu?
- January 23, 2023
- 2 replies
- 1781 views
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;
