Checking checkboxes updates in the backend but not the frontend

  • renske.renske-1347970271415500850

    R

    7 days ago

    Hi! I built a checklist. I noticed that while the back-end updates correctly, the visual representation in the checkbox doesn't always reflect these changes. I'm trying to figure out why the checkbox in a row remains checked even when the item it belongs to moves down due to the item sorting. If anyone has insights on this issue & sees what I am overlooking, please let me know!

    I have added a video to show what I mean: https://www.loom.com/share/3930db8c89094bb383bd285584e2c583?sid=98a4fdd8-5d33-4e1c-ae66-28358d4117d8

    The overall setup is complex as it is an expandable list with expandable items, but I had the same issue before I added the expansion. Also please ignore/forgive the complexity of my app atm - the next item on my list is to change the parts that should be components to components - it is intimidating to take that step though...
  • lucasg-1347971872687390811

    Lucas G

    7 days ago

    The checked attribute dictates whether a checkbox is checked by default (on load)
  • It doesn't determine it's current value
  • lucasg-1347972281376440387

    Lucas G

    7 days ago

    The solution to this would be to create a checkbox component which handles the state by its value instead
  • renske.renske-1347972559362068584

    R

    7 days ago

    aha! guess I can get started on components then :D..
  • Tod-1347972563401445386

    Tod

    7 days ago

    Great energy @R! Your continuous contribution to the toddle Community just made you advance to Community Level 3!
  • renske.renske-1347972663326408815

    R

    7 days ago

    you mean to create a component that functions like a checkbox?
  • rather than an input I mean
  • lucasg-1347972834638561401

    Lucas G

    7 days ago

    Yes, components will help a lot with this type of thing. Things like repeating lists (especially when they all need their own states) are prime examples of things comopnents are great for
  • lucasg-1347973096304545832

    Lucas G

    7 days ago

    You can still use an input for accessibility purposes and visually hide it for example
  • There are a few ways you can go about it
  • An example is a 'toggle' element. They're really checkboxes under the hood but styled as a toggle
  • renske.renske-1347974207325343805

    R

    7 days ago

    thanks so much for the quick reply btw
    πŸ‘1
  • so you mean to build a component that functions as a checkbox (eg when it is clicked it takes a different color and sets a variable)?
  • lucasg-1347977711766999161

    Lucas G

    7 days ago

    Yeah, there are a few ways to go about it but that's basically the idea.
  • It doesn't need to hold a variable itself if you don't want it to, it can just rely directly on the input value (for example via attributes)
  • But the main point is that the visual 'checked' state would come from the data
  • renske.renske-1347983348315979857

    R

    7 days ago

    okay understood, rather than from what the data was like on load. To make sure I fully understand, the (super inefficient and possibly impossible) alternative would be to reload the page every time the box is checked - right?
  • lucasg-1347983743897305170

    Lucas G

    7 days ago

    If you're only relying on the checked attribute, then yes. Though that wouldn't be a great user experience lol
    πŸ˜‚1
  • lucasg-1347985938344710194

    Lucas G

    7 days ago

    I think the Spark One template has checkboxes
  • That might be a place to easily grab it from
  • renske.renske-1348695428136439861

    R

    5 days ago

    I built the component - and then had the exact same behavior πŸ˜‚ luckily it was a quick fix and I just had to exchange basing the visual state on the attribute instead of a variable. In the meantime, I also created components for my repeating titles and menu-bar. This is great and really not that hard, I should have started earlier πŸ˜… Thank you @Lucas G !
    πŸ”₯2
  • lucasg-1348714782047473676

    Lucas G

    5 days ago

    Nice! The more you build the more you’ll find components to be valuable

Stop scrolling. Start building.

toddle is a visual web app builder that rivals custom code β€” but accessible to your entire team!

Try toddle β€” it's free!

Β© Copyright 2024 toddle. All rights reserved.