SOLVED

Form checkbox: Save True/False instead of yes/no

Go to solution
lukea
Level 3

Form checkbox: Save True/False instead of yes/no

Hello Marketo Nation,

I've got a form field of type string, which is embedded as a checkbox. Upon form submission, it's either saved as "yes" or "no" to the Marketo Database. However, I want it to have "True" and "False" respectively. The field is synced with another platform, so ideally this mapping is reflected during form submission already, not corrected afterwards using a smart campaign. What's the best way to do this?
Thanks in advance for your help!

 

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator

Re: Form checkbox: Save True/False instead of yes/no

The quickest way is to switch to the Checkboxes type (not singular Checkbox) w/a single box.

 

I'd recommend, though, that you use lowercase "true" and "false" for anything that might need to become a true Boolean in future. 

View solution in original post

2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Form checkbox: Save True/False instead of yes/no

The quickest way is to switch to the Checkboxes type (not singular Checkbox) w/a single box.

 

I'd recommend, though, that you use lowercase "true" and "false" for anything that might need to become a true Boolean in future. 

lukea
Level 3

Re: Form checkbox: Save True/False instead of yes/no

Interesting, it seems to work. Using the `checkboxes` instead of the `checkbox` type would allow me to set an arbitrary value - e.g. 'true' or 'foo' - for checked string values, and the unchecked value is by default always saved as 'false', right?

 

Why would it make a difference to use "true" instead of "True" or "TRUE" - do you have a specific scenario on your mind, where it becomes problematic, if one wants to convert the string to a boolean?