Disabled toggle doesn't work
See original GitHub issueIf 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:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Awesome - closed! 🔥
I’m also ok with the documentation approach. So let’s close the issue?