Re: Null as field value

Yaron_Meiner
Level 2

Null as field value

I had a user that filled a form with "null" as the company name. Since i am not using embedded marketo forms but backend submission, the value of the company name was null. even if i sanitize the field, the value is still null because it's a valid string. The result of it was that the company name stayed empty and the lead did not sync into SF because of the mandatory field requirement.

 

I have a way to validate and return an error to the user on form field globally in code but i wanted to use the smarts of the nation and see if there is a better way to resolve this. Please feel free to bash me for bad behavior if exists.

 

Yaron

3 REPLIES 3
Yaron_Meiner
Level 2

Re: Null as field value

I just tested it, it happens also with embedded Marketo forms...

Tags (1)
SanfordWhiteman
Level 10 - Community Moderator

Re: Null as field value

Not sure I see the problem?

 

All form field values are strings in transit: unlike JSON properties, they're not typed unless the back end decides that some have special meaning, like Marketo also does with  NULL.

 

If you want to avoid the system-special values you'd need to create your own special value, like [N/A].

Yaron_Meiner
Level 2

Re: Null as field value

I understand that but what happens when the user decides to put 'null' in one of the fields?

The two solutions here, in my opinion, can be:

  1. As suggested - to replace the value of the field to something else. [n/a] might be a good solution because it keeps the field with some value. this can be done either with a smart campaign or with a piece of code 
  2. My preferred action - to return to form on validation level or mark to the user that they have to put a real company name (and risk that NULL inc is not using a shortened brand name)

I would actually want to see it as a functionality of the embedded forms.