Select listvalue and autopopulate formfield

25 Views Asked by At

hope someone can help me with this one. I need to select a value from a List and then populate another Formfield with a specific value depending on what i select in the list, in this case e.g. number 1995 if i select value "12" (im not sure if this has the right syntax in script below) in the selectionlist the "Formfield_1" should be populated with the value 1995 and if i select value "18" in the selectionlist, the "formfield_1" should be autopoulated with the number 2995 i, how do i resolve this?

example:

var a = this.getField("SelectionsList").value;
var b = this.getField("SelectionsList").value;
var c = this.getField("Formfield_1").value;
if( a = "12") event.value c = "1995";
if( b = "18") event.value c = "2995";

As you can se i have difficulties with the syntax in how i get values in var a b and populate the desired value in var c i have chosen to run this as a calcutlation from the properties tab "Format" and Custom keystrokescripts in the selectionsList, maybe it shouldnt be placed there at all?, i want it to do the calculations when/after a selection is done in the SelectionsList.

1

There are 1 best solutions below

0
On BEST ANSWER

The solution is

var a = this.getField("SelectionList").value;
if( a == "12") event.value = "1995";