Hi. I have a dropdown list "Dropdown1" with some values that show the relative content, for example:
- value = 0 shows " "
- value = 1 shows "abc"
- value = 2 shows "def"
- value = 3 shows "ghi"
Now, I have a text field "Text1". I would like that when I select a value in the list, this populates the text field with the same content. I know I can use this calculation script in "Text1":
var f = this.getField("Dropdown1");
if (f.valueAsString=="0") event.value = " ";
else if (f.valueAsString=="1") event.value = "abc";
else if (f.valueAsString=="2") event.value = "def";
else if (f.valueAsString=="3") event.value = "ghi";
but if if I allow to customize the text of the selection of the dropdown list, this change (rightly) does not appear in the text field. I would like to work around the problem and impose that the content (and not the value) that appears in the list, appears identical even in the text field. Thanks
Not sure what you mean by the distinction between "content" and "value", unless you're referring to the export values... Anyway, the solution to this issue is quite simple. Add this line to the end of your code:
else event.value = f.valueAsString;