Can I exclude certain words in form prefill? | Community
Skip to main content
New Participant
March 22, 2021
Solved

Can I exclude certain words in form prefill?

  • March 22, 2021
  • 1 reply
  • 1774 views

Hi,

I was wondering if there is a way to have form prefill enabled, but exclude certain words from being prefilled. We use "not entered" on CRM imports to bypass required company and last name fields, but we want to make sure that if someone was created from a CRM import and has a last name or company of "not entered" that it does not get pulled into the form prefill. So essentially, we are hoping to find a way to exclude "not entered" from being populated on all of our forms while still keeping prefill enabled on these fields. 

 

Thanks!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by SanfordWhiteman

I was wondering if there is a way to have form prefill enabled, but exclude certain words from being prefilled.


Not natively, no. But it can be done easily. Add this JS just before the closing </head> tag:

(function(){ const effectivelyEmptyValues = ["not entered"]; Object.keys(mktoPreFillFields) .forEach(function(fieldName){ const fieldValue = this[fieldName]; if(effectivelyEmptyValues.indexOf(fieldValue) != -1){ delete mktoPreFillFields[fieldName]; } },mktoPreFillFields); })();

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
March 22, 2021

I was wondering if there is a way to have form prefill enabled, but exclude certain words from being prefilled.


Not natively, no. But it can be done easily. Add this JS just before the closing </head> tag:

(function(){ const effectivelyEmptyValues = ["not entered"]; Object.keys(mktoPreFillFields) .forEach(function(fieldName){ const fieldValue = this[fieldName]; if(effectivelyEmptyValues.indexOf(fieldValue) != -1){ delete mktoPreFillFields[fieldName]; } },mktoPreFillFields); })();