Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

130
Views
Iterated over a checkbox and displaying a user's input in App Studio

I'm trying to take a user's input from a checkbox in AppStudio, storing it in a list, and then displaying that list. However, when I run this code the chosenFoods list is blank.

var checkboxFoodChoices = ["mexican", "italian", "chinese", "american", "brazilian", "french"];
var chosenFoods = [];

button2.onclick=function(){
    for(var j = 0; j < checkboxFoodChoices.length; j++){
      if(checkbox1.getValue(j) == checkboxFoodChoices[j]){
            chosenFoods[j] = checkboxFoodChoices[j]
            
          } // if statement
      } //for loop
    console.log(chosenFoods)
} //onclick

I tried it a different way but the list then displays [empty, empty, chinese] if I chose the third value in the list instead of just [chinese]

var checkboxFoodChoices = ["mexican", "italian", "chinese", "american", "brazilian", "french"];
var chosenFoods = [];

button2.onclick=function(){
    for(var j = 0; j < checkboxFoodChoices.length; j++){
      if(checkbox1.getValue(j)){
            chosenFoods[j] = checkboxFoodChoices[j]
          } // if statement
      } //for loop
    console.log(chosenFoods)
} //onclick
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!