How do you stop a button from executing?

  • mesmoiron-1298587672834478110

    mesmoiron

    5 months ago

    Hi, I have a variable and if it is empty/reset than some other button should not do the click event. I want to prevent empty items added to the to do list. I have tried the click event or the add item workflow, but in the formula the variable keeps disappearing if I set the first value as an empty string. Depending on my test run, the formula keeps changing, while I try to set the desired logic.
  • plusmin-1298597532984934453

    Armand

    5 months ago

    The first thing that comes to mind is to use a Switch. But perhaps you can share a video or a few screenshots to show what you are trying to do as it's hard to get a good picture without visual context.
  • max.kayr-1298598165393444895

    Max

    5 months ago

    Can you share the project link? Than we could have a look
  • mesmoiron-1298599276758175797

    mesmoiron

    5 months ago

    Yes, I will make some pictures
  • Tod-1298599988372308095

    Tod

    5 months ago

    Great energy @mesmoiron! Your continuous contribution to the toddle Community just made you advance to Community Level 6!
  • lucasg-1298624205721702481

    Lucas G

    5 months ago

    You can conditionally disable the button
  • If empty
  • 128651941143117824-@Lucas G
    If empty
    mesmoiron-1299616044217794594

    mesmoiron

    5 months ago

    Can you tell how to do it? if it is empty then :
    do nothing
    stop
    block
    What is the wording or function to call? Or is it the place. I tried putting it in the else part, but it still makes an empty item. Unless I have to remove that item. But that doesn't sound as the correct way to do it.
  • tomthebigtree-1299622716181184544

    Tom Ireland

    5 months ago

    There is an HTML attribute called disabled, which allows you to disable a button. You can set a formula on this attribute to check if the variable is empty. If true, set disabled to true; else set it to false.

    See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled
  • plusmin-1299624574710976533

    Armand

    5 months ago

    I had the same answer as Tom πŸ™‚
    πŸ’―1
    πŸ”₯1
    πŸ’ͺ1
  • tomthebigtree-1299626212834021377

    Tom Ireland

    5 months ago

    ☝️ This right here. Nice one, Armand! πŸ’ͺ
    πŸ‘1

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.