Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].
Hi,
How can I add a state emitter for checkbox field? E.g. show/hide another field when a single checkbox is checked!
Thank you for this amazing plugin and your support!
Hi Filipe
Sorry for the late reply. I’m just coming off a little bit of a holiday :)
I haven’t actually tested state emitters with a checkbox, but I imagine you could do this with a simple conditional state emitter. Something along the lines of
And then you’ll just need to handle that with a state handler – https://siteorigin.com/docs/widgets-bundle/form-building/state-emitters/#heading-state-handlers
If the standard conditional state emitter doesn’t work for a checkbox, then you could also try a custom state emitter. This would give you fairly fine grained control over the state that’s emitted from the checkbox.
https://siteorigin.com/docs/widgets-bundle/form-building/state-emitters/#heading-custom-callbacks
As soon as I get a chance I’ll take a proper look at checkboxes and state emitters. So far, in our own widgets, we’ve only ever needed them for select fields.
Hi Greg, thank you for the answer.
Unfortunately, it doesn’t work with the standard conditional state emitter, at least on my try!
I want to create a simple switcher, and use the conditional state emitter to show/hide when button is on/off.. :(