question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Disabled toggle doesn't work

See original GitHub issue

If I set disabled to true in a toggle then the toggle grays out and the “disable” icon comes up when hovering over the toggle, but I can still press it and all the side-effects still get executed. MWE:

using Dates
using Stipple, StippleUI
using Genie.Renderer.Html

Base.@kwdef mutable struct Example <: ReactiveModel
    onoff::R{Bool} = false
    disable::R{Bool} = false
end

function togglefun(tf)
    if tf
        println("true", now())
    else
        println("false", now())
    end
end

function restart()
    global model
    model = Stipple.init(Example(), debounce=1)
    on(togglefun, model.onoff)
end

function ui()

    app = dashboard(vm(model),
        [
         heading("Example"),
         row(cell(class="st-module", [
                                      p(toggle("Toggle", fieldname = :onoff, disabled = :disable))
                                     ])),
        ], title = "Example")

    html(app)
end

route("/", ui)
Genie.config.server_host = "127.0.0.1"
restart()
up(open_browser = true)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
essenciarycommented, Apr 20, 2021

Awesome - closed! 🔥

0reactions
hhaenselcommented, Apr 20, 2021

I’m also ok with the documentation approach. So let’s close the issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Toggle disabled property using jQuery's prop() doesn't work
I'm trying to use jQuery's .prop() and removeProp() methods to enable and disable a button based on some criteria. It seems to work...
Read more >
Toggle buttons don't honor [disabled] or .disabled #21237
There doesn't appear to be a clean way to disable a button state toggler. I've tried the following:
Read more >
Problem with toggle switch to disable a button for all users
This works fine for me when I'm clicking the toggle, I can see the SharePoint list column change, and I can see the...
Read more >
What is Toggle disabled? - GDevelop Forum
Toggle disable disables any event and they won't work during Preview. ... events again so instead of deleting them we use Toggle disabled...
Read more >
How to disable or enable buttons using Javascript and jQuery
Learn how to enable or disable buttons using javascript and jQuery based on whether the input field is filled or empty.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found