FORM-Issue-Terms and conditions(Alert email).

Madhavi_T
Level 2

FORM-Issue-Terms and conditions(Alert email).

Hi,

When a lead checks the terms and conditions on a form, in an alert email I receive I expect- "The lead checked terms and conditions-Yes(as status)". but the value displayed is as "1" instead of "Yes".

What might be the reason and how can it be corrected.

Please help me with this.

9 REPLIES 9
SanfordWhiteman
Level 10 - Community Moderator

Re: FORM-Issue-Terms and conditions(Alert email).

Please search before posting! This is exactly the same (answered) question from earlier today: Alert email not reflecting form input

Madhavi_T
Level 2

Re: FORM-Issue-Terms and conditions(Alert email).

Hi,

Am trying to use terms and conditions token, not an email script token or any other.

SanfordWhiteman
Level 10 - Community Moderator

Re: FORM-Issue-Terms and conditions(Alert email).

Please read the context of the other question more carefully. It's the same situation as yours.

If you want a Boolean field to display with custom true/false text, instead of "1" or an empty string, you must pass the field into a Velocity token and output from there.

Eric_Salamon1
Level 6

Re: FORM-Issue-Terms and conditions(Alert email).

Madhavi,

It looks to me as you are maybe not familiar with some tech language the computer reads true or false as 1,0 so when some one says false they are actually selecting 0. It may be easier to override that using the Velocity token Sanford mentioned if value = 0 or null then set value to false or value = 1 set value to true.

I have very limited scripting experience in velocity, but that would be the general language. Hope this helps.

SanfordWhiteman
Level 10 - Community Moderator

Re: FORM-Issue-Terms and conditions(Alert email).

Sorry, gotta be pedantic... in this case it's not that the boolean is being stored as bit 1/0. The boolean might never have an integer representation, but it's being stringified as "1" or "" into Velocity (this comes from PHP output semantics, not Velocity/Java). 

In PHP the string-as-boolean comparison would still work with those values due to type juggling. But in Velocity/Java this breaks, since an empty string is more truthy than falsy, i.e. both options are truthy.

That's why you need to either look for the specific String values "1" or "" or cast explicitly to Boolean.

Eric_Salamon1
Level 6

Re: FORM-Issue-Terms and conditions(Alert email).

I appreciate the correction, I thought I added the null or empty choice in my statement. At the same time the general concept is the same. you are looking for the specific value  or null value and replacing it with the text one.

SanfordWhiteman
Level 10 - Community Moderator

Re: FORM-Issue-Terms and conditions(Alert email).

But null is already falsy in Velocity, while an empty string is truthy by default.

(It's only due to our knowledge of the original datatype that we can cast/treat a truthy String as Boolean false, otherwise it would be unsafe.)

Such are the realities of spending more time in this programming environment than can possibly be healthy...

SanfordWhiteman
Level 10 - Community Moderator

Re: FORM-Issue-Terms and conditions(Alert email).

And I do appreciate you working to explain this for the OP. Note sure if Madhavi is listening anymore, though.

Madhavi_T
Level 2

Re: FORM-Issue-Terms and conditions(Alert email).

Thank you so much.