Total Newbie - Help how to disable a input field based on a checkbox being checked

Hi just wanted to know how to disable a input field based on whether a checkbox is unchecked. I know its likely a newbie question just need some code to get me started on my journey in learning appsmith Thanks

Hello and welcome to Appsmith, @CHIDMAS!

I’m Jimmy with Appsmith support. :wave:

Each widget has a Disabled property that you can find in the property pane. You can click the JS icon next to the property name to get a text field instead of a toggle switch, and this text field accepts JavaScript using our mustache syntax ({{code_here}}).

You can enable/disable a widget based on the status of a check box by placing the following snippet in the widgets Disabled property:


hahahahaha thank you, I can’t believe it was that easy, although I have understood more stuff trying to work that out. Thank you

Just realised it kind of does what I need but its actually the inverse so when it is unchecked it is disabled

You can invert booleans in JS by putting an exclamation mark in front of the expression body. In this case it would look like this:


thank you thank you thank you. You have made someone very happy

No worries! Thanks for using Appsmith, and happy smithing!