Skip to main content
Participating Frequently
November 28, 2016
Question

value from two dropboxes in one text field

  • November 28, 2016
  • 5 replies
  • 272 views

Hi,

I've been searching for a solution for this for two days....

Basically, I have dropbox01, dropbox02, and textfield01. I need to get the choices from both of the dropboxes into one textfield.

At the moment I have in textfield01 custom calculation:

var v = this.getField("dropbox01").value;

if (v=="Choice01") event.value = "some text" + getField("textfield02").valueAsString + "some text"; 

if (v=="Choice02") event.value = "some text" + getField("textfield02").valueAsString + "some text";             

if (v=="Choice03") event.value = "some text" + getField("textfield02").valueAsString + "some text"; 

var z = this.getField("dropbox02").value;

if (z=="Choice01") event.value = "some text" + getField("textfield03").valueAsString + "some text"; 

if (z=="Choice02") event.value = "some text" + getField("textfield03").valueAsString + "some text";             

if (z=="Choice03") event.value = "some text" + getField("textfield03").valueAsString + "some text"; 

Here textfield02 and textfield03 are just field with some info in them.

I can get only one of the choices in this textfield. I've tried &&, or, ||, but none of them work the way I want. I just want "Dropbox01" + "Dropbox02".

Thank you in advance for your help.

This topic has been closed for replies.

5 replies

try67
Community Expert
Community Expert
November 28, 2016

var v1 = this.getField("dropbox01").valueAsString;

var v2 = this.getField("dropbox02").valueAsString;

event.value = v1 + " " + v2;

Participating Frequently
November 28, 2016

Thanks.

Sorry, I forgot to mention that due to language specifics, the choices saved in dropboxes must appear differently as string in textfield01.

As in, if I pick Choice01, the string is "Variation of Choice 1 + some text".

Participating Frequently
November 28, 2016

I understand what has to be done, but do not know the syntax. As in, how to define a choice in dropdown box to appear differently.  For example, an option "Thomas" should appear in the textfield as "Thomas, who lives in NY".