We are trying to set up a process where if a person submits a form, and a non-required field is left empty, we infer that means the person no longer has that item.
Example: Bill told us 4 years ago he grows Rice. This year he renews his subscription to our magazine and leaves Rice blank (we cannot pre-fill per print audit rules). We want to have Marketo wipe out his previous answer and assume he no longer grows rice.
Can that be accomplished?
I thought perhaps have some sort of trigger campaign but that will overload our system and create a log jam in our Campaign Queue.
Ideas?
Solved! Go to Solution.
That's the exact situation I covered here: http://blog.teknkl.com/clearing-lead-fields-when-no-value-submitted/
That's the exact situation I covered here: http://blog.teknkl.com/clearing-lead-fields-when-no-value-submitted/
Hi Sanford Whiteman,
I have read the blog article and have a question: why adding a null value to the fields in the form. Why not simply capturing the fact that the form fields are empty and set a NULL value ?
-Greg
Because not every field is expected to turn no answer → NULL.
The same could be done with a configuration block at the top of the JS, but I opted to not do that in this case.
OK,
It's just a way to detect which fields should be processed that way. So a class in the label would also do the trick. Or a conf field by a token and containing the list of data-wrapper-for tag attributes ?
-Greg
Right, I would use an array of field names if going with the conf block.
Here is my code, using an array, but the NULL does not post to the database
Page : placo
result:
and the field remains unchanged...
Any idea bout a bug I might have introduced?
-Greg
Ha! Now I remember (stupid to forget) the other reason I add the "NULL" as an actual value: you can't setValues() on an enum field (checkboxes, select, radio) unless the value exists as part of the enumeration.
Also, be careful to not use Array#includes, Object.entries, or Object.values on public sites yet as they don't work in IE.
And I'd probably have done the iteration like this:
Object.keys(currentVals)
.filter(function(field){
return ( NullifiableFieldNames.indexOf(field) != -1 && currentVals[field] );
})
.forEach(function(field){
newFormData[field] = "NULL";
});
you can't setValues() on an enum field (checkboxes, select, radio) unless the value exists as part of the enumeration
So I guess then the best way to set this up is to select all the fields that have a NULL in the enumeration as you did in the blog post and drop the idea of designating the fields through an array.
Thx so much!
-Greg
Hi again Sanford Whiteman,
Also, be careful to not use Array#includes, Object.entries, or Object.values on public sites yet as they don't work in IE.
How do I test the existence of a field in the form ?
-Greg