Jump to content
  • 0

Ranking Drop Down or Radio Buttons


jimarch

Question

I'm needing to create drop down or radio button section that will allow the user to "rank" their choices.  I have 4 locations and want them the to rank their preference to that location by selection 1 - 4.  But I only want unique answers to each one.  So if they rank one as number 1, then I don't want number 1 to be an option for the remaining 3 choices and so on.  I've tried several ways but can't get it to work correctly and wasn't able to find any other posts that described this.  Any suggestions on if and how it can be down are greatly appreciated.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hi @jimarch,

You can utilize Cascading radio buttons and lookup table which would output all possible combination of ranks.

Users will be forced to submit their "rank" choices for each location in sequential order.

Your first location will have radio-buttons "1-4 " and each next location will have a set of radio - buttons without the one selected on the previous step.

You may upload the following app sample and test above  - mentioned workflow in the Data page I have created:

App

Regards,

vitalikssssss

 

Link to comment
Share on other sites

  • 0

Try this one, just create a var for each dropdown you have, put that var in the two arrays (dropdownarray and valuesarray) , and you're good to go

<script>

document.addEventListener("change", function(event){

var d1 = document.getElementById("cbParamVirtual1");
var d2 = document.getElementById("cbParamVirtual2");
var d3 = document.getElementById("cbParamVirtual3");

var dropdownarray= [d1,d2,d3]
var valuesarray=[d1.value, d2.value, d3.value]

for(var j=0; j<=dropdownarray.length;j++){ //counter for dropdownarray 

for (var i=1; i<dropdownarray[j].length; i++) { //counter for options on each dropdown excluding the 'SELECT' option

    if (valuesarray.indexOf(dropdownarray[j].options[i].value) > -1){ //indexOf returns -1 if value is not in the array

         dropdownarray[j].options[i].style.display = "none";
       }
    else {
         dropdownarray[j].options[i].style.display = "block";
       }
  }



}



});


</script>

image.png.85376772b1113e36e9125572e7cef5f0.png

 

image.png.477f819415679e222a819b27c59b66e7.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...