Changing checkbox's default value

How do I change a checkbox's default value from true/false to cat/dog? I've tried the below but it doesn't work.

{{checkbox1.value == "false" ? "cat" : "dog"}}

Hi @rcanpolat,

Thanks for reaching out! The default value field can only evaluate to true or false since that will determine if the checkbox is "checked" or not. Can you share more about your use case? Happy to try to find a different solution

You could use similar logic in the label if you wanted the label to change:

{{checkbox3.value === false ? "cat" : "dog"}}

Thanks for the reply. I was writing the data to a nvarchar(20) on SQL so I thought it would allow me to write a custom boolean value from the checkbox, not just true/false or 1/0.

No major use case, it was just for a user who would be looking at the SQL table (outside of Retool) and I wanted to make the raw table data more friendly in case they didn't understand the meaning of the true/false or 1/0 in relation to the column name.


Vehicle Status

Instead of...

Vehicle Status


Vehicle Status

Hey @rcanpolat! Stepping in here as well :slight_smile:

Aside from adding this logic post-component (e.g. in your SQL query)...

You could add an event handler to your checkbox that sets a temporary state depending on the checkbox value:

Then in your query, you just reference {{ state1.value }} instead of {{ checkbox1.value }}

Would something like this work for you? Let me know either way! :crossed_fingers:

Yea that should work for me, thanks @victoria

Awesome :sunglasses: Write back in anytime!