Retrieve checkbox value

  • /attachments/1316830344686735391/1316830345005633637/image.png

    Dov

    1 month ago

    I am having difficulty getting the true/false from a checkbox.

    I have setup the checkbox by adding an attribute called checked which is bound to a bool in an array. Then on input (or change) event I want to get the value. But when I go into the editor all I can see is event-target-value. How do I get the checked state?
    image.png
    image.png
  • Lucas G

    1 month ago

    On input just set the variable to the reverse of its current state
  • variable -> not node
  • Dov

    1 month ago

    Ok.
  • /attachments/1316830344686735391/1316833286097473636/image.png

    Dov

    1 month ago

    Another quick question - is this the correct way to bind the variable? The data is set to true, but when loading it seems to flash true then goes false.
    image.png
  • Lucas G

    1 month ago

    You could try adding a Default to node
  • Default to false
  • Dov

    1 month ago

    Sorry, what does that mean (I am not sure where to do that)?
  • Lucas G

    1 month ago

    There is a node called default to
  • It is a very useful node. I personally use it often
  • Dov

    1 month ago

    Is this what you mean? I am not sure what a node is 😥
  • /attachments/1316830344686735391/1316834928452964412/image.png

    Dov

    1 month ago

    image.png
  • Lucas G

    1 month ago

    Ah no. I meant a formula node
  • Lucas G

    1 month ago

    In that formula, click the plus icon and add a Default to node in between
  • Dov

    1 month ago

    ok
  • Tod

    1 month ago

    Great energy @Dov! Your continuous contribution to the toddle Community just made you advance to Community Level 6!
    👍1
  • /attachments/1316830344686735391/1316835964315898006/image.png

    Dov

    1 month ago

    I have done that. Is it correct that the value is now null?
    image.png
  • Lucas G

    1 month ago

    Yeah refresh the page and test it out
  • Dov

    1 month ago

    ok
  • Dov

    1 month ago

    Thanks. I got it working.

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.