PricingBlog

Multi select checkboxes, store data in variable

  • mix3601-1242463071205589012

    mix3601

    1 year ago

    Does anyone have experience in working with a repeat div that has a checkbox?

    I'm thinking of listening to the change state, then adding the record to an array, if the checkbox is unchecked, then removing the record from the array. Is this a viable solution? Thanks 🙂
  • Tod-1242463075068547173

    Tod

    1 year ago

    Great energy @! Your continuous contribution to the toddle Community just made you advance to Community Level 2!
  • gazinhio-1242496327737151549

    gazinhio

    1 year ago

    It's pretty straightforward. On the event that someone ticks the box, set an array to a formula which checks if the item is already contained in the array and if so then Delete it and if not Append it.
    1242496327494140056-Screenshot_2024-05-21_at_16.16.20.png
  • mix3601-1242532543140593785

    mix3601

    1 year ago

    Thanks 🙂
  • mix3601-1242917482910584832

    mix3601

    1 year ago

    The above works great in keeping track of what records is selected in my table - however, i'm left with an index - how do i map that index to the actual data from the table? I've tried switching the item and index with the repeat item and index, but that did not work.
  • gazinhio-1243138134544224317

    gazinhio

    1 year ago

    In the above, it's storing the index of the item that's clicked. If you need to find the record that's represented by that index then you can use the Get formula. So you'd set your data list array as the Array input for the Get, in the Path input you'd use the index that you've got and that will return the record from the list that is represented by the index. I hope that makes sense.