Super Simple Web Switch Control?

Hey,
Found this post when searching for a switch control for web.
Tried it in 2024r3 but it does not seem to do anything.

Anyone else got this to work or has it broken in newer versions of our beloved X? :slight_smile:

Found the issue. Changed ‘custom-switch’ to ‘form-switch’ and it works :slight_smile:

Me.ExecuteJavaScript(“document.getElementById('” + Me.ControlID + “').classList.add(‘form-switch’);”)

Have a great night!

2 Likes

Thanks for sharing solution :+1:

2 Likes

Using 2024r3 it’s easier, you can just go to the advanced tab and place the “form-switch” class name here:

We’ve included an example (“Applying Bootstrap CSS classes to controls”) with some useful CSS Classes you can use in your projects, including the Switch control:

Here is the blog post with the announcement:
Introducing Named Color and CSS Classes in Xojo Web

7 Likes

Ricardo,
Thanks a lot. This example helps to solve many problem related to CSS and UI.

1 Like