Skip to main content
Participant
October 31, 2022
Question

Drop Down List using previous fields

  • October 31, 2022
  • 1 reply
  • 552 views

I am trying to create a World Cup Sweep sheet.

 

I have made up drop down lists with winners and runners up in groups.

 

Trying to create a new drop down list to show selections from the above.

 

E.g. If someone listed 1 of the last 16 matches as Netherlands v USA and the next as Argentina v Denmark.  I am looking to get a drop down for quarter final 1 to show as either Netherlands or USA and another drop down as either Argentina or Denmark?

 

Is this possible?

 

This topic has been closed for replies.

1 reply

Nesa Nurani
Community Expert
Community Expert
October 31, 2022

You can populate dropdown fields using setItems().

Since there are no more groups after stage 1 wouldn't be easier to use a text field to populate country name instead of a dropdown field?

Participant
October 31, 2022

I am trying to make it so that you only get to choose between the teams entered in the previous round.

Nesa Nurani
Community Expert
Community Expert
October 31, 2022

Use this as validation script of "1st Group A" field:

var C = ["Choose L1 Winner"];
var gb = this.getField("2nd Group B").valueAsString;
if(event.value != "Choose" && gb != "Choose"){
C.splice(1);
C.push(event.value,gb);}
else
C.splice(1);
this.getField("L1 Winner").setItems(C);

Use this as validation script of "2nd Group B" field:

var ga = this.getField("1st Group A").valueAsString;
if(event.value != "Choose" && ga != "Choose"){
C.splice(1);
C.push(ga,event.value);}
else
C.splice(1);
this.getField("L1 Winner").setItems(C);

I can't see on your photo but if "Choose" is not the default value, change it.