Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Mutiple textfields choice

Avatar

Level 1

I am working on a form and i need to be able to augment the value of multiple text fields based on a dropdown list selection.  this works fine but i also need to add a second drop down list which will augment the value of textfields in the same area.

an example would be i have 10 textfields and 2 dropdowns

dropdown1 has 3 options each option augments a different amount of text fields say option1=2, option2=8, and option3=5

dropdown2 has 2 options and each aguments 1 textfield.

Without specifically leaving the first textfield open how can i ensure that dropdown2 augments the value of the first blank textfield?

3 Replies

Avatar

Level 3

I'm not entirely sure what you're asking here. Are your dropdown selections changing the value of the fields, or giving you that number of fields to fill?

You say your first drop down is working, but not the second? Is there code or anything you can show us?

Avatar

Level 1

Both dropdowns work correctly, however, because of the difference in results the layout can look strange with my current set up. 

The basics of the code I am using is dropdown1 has on its exit field:

var switchvar1 = this.rawValue;

switch (switchvar){

case "option1":

var opt1txt1 = "some text";

var opt2txt2 = "some text";

textfield1.rawValue = opt1txt1;

textfield2.rawValue = opt1txt2;

break;

case "option2":

var opt2txt1 = "some text";

var opt2txt2 = "some text";

.

.

.

var opt2txt8 = "some text";

textfield1.rawValue = opt2txt1;

textfield2.rawvalue = opt2txt2;

.

.

.

textfield8.rawValue = opt2txt8;

break;

case "option3":

var opt3txt1 = "some text";

var opt3txt2 = "some text";

.

.

var opt3txt5 = "some text";

textfield1.rawValue = opt3txt1;

textfield2.rawValue = opt3txt2;

.

.

textfield5.rawValue = opt3txt5;

break;

}

dropdown2 has the following code on it exit field:

var switchvar2 = this.rawValue;

switch (switchvar2){

case "option1":

textfield9.rawValue = "some text";

break;

case "option2":

textfield9.rawValue = "some text";

break;

}

so they both work however if i choose option 1 or option 3 on dropdown1 there are several blank textfields between the last one filled by dropdown1 and the one filled by dropdown2.  I would like to know if there is a way to make it so that dropdown2 fills the first empty textfield.  So if i have option1 selected on dropdown1 then dropdown2 would fill textfield3 rather than textfield9.

Avatar

Level 3

Ah, I see what you mean. Probably the best way to do that is to set some of the text fields to hidden when the text fields are blank. If your form is flowed, then depending on the case statement chosen, mark those text fields as textfield3.presence = "hidden"; that will hide it and then cause whatever is underneath to jump up in it's place.

If flowing the form makes the text fields move places you don't want them to, then try wrapping them in positioned subforms first, and hide the subform itself rather than the field.

Hope this helps.