Copy link to clipboard
Copied
Can samebody please help me with setting this up to a form?
I needo to auto-fill a field based on a Drop-Down field choice, but i am a begginner with javascript.
Can some body give me a code for this?
Dropdown field is named FieldA, items are ChoiceA and ChoiceB.
This choice must fill another fields with 10 for Choice A or 15 for ChoiceB.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Easiest way is to set those numbers as the export values of the items in the drop-down, and then use something like this as the custom calculation script of the text field:
event.value = this.getField("FieldA").valueAsString;
Copy link to clipboard
Copied
This is EXACTLY what i need to do, but based on a drop down menu chioce. Thank you for your answer. I will paste my code until now, and you correct it, please?
What I need: i need to put your sugestion where it is read "D.0.0:" and "I.0.0"
// Nome das habilidades
var HabData = { Acrobacia:{ atributo: "D.0.0",
},
Leitura:{ atributo: "I.0.0",
}};
function SetFieldValues(cHabName)
{
this.getField("HabAtrib").value = HabData[cHabName].atributo;
}