Small issue with when using SimpleDTO.js | Community
Skip to main content
Philippe_Sanchi
New Participant
January 31, 2023
Solved

Small issue with when using SimpleDTO.js

  • January 31, 2023
  • 1 reply
  • 1780 views

Hello, 
One of our supplier helping us to deploy Marketo used progressive profiling script from @sanfordwhiteman on our Website to get benefit from Progressive Profiling when Landing Page isn't hosted on Marketo.

Progressive profiling is working fine when the contact is recognized. However, for unknown people reaching our form, we noticed a small issue related to predefined fields. Actually, we do have a field to select the country that is set to a predefined value. When person isn't known and recognized, the default value is removed. We did try to debug script to understand what is happening. In debug mode, we saw that at the begining of the display of the page, our default value for country is well displayed. However, later call of simpleDTO script is removing the value. We noticed that this happens at following steps in the script:

MktoForms2.whenReady(function(form) {
          form.setValuesCoerced(mktoFields);
        }); 

 

Not sure if it is normal, so this is why we raised it. In the meantime, we solved it at our website level by forcing it through another script.

 

 

Note : was applied what is listed in Sanford blog -->  https://blog.teknkl.com/pre-fill-any-site-any-form/

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

That's expected behavior. If the field is empty and you prefill an empty value, that's still a valid value.

 

You can remove the empty values from the fields object if you want, although I'd caution that there are situations where Pre-Filling the empty value is appropriate.

MktoForms2.whenReady(function(form) { Object.keys(mktoFields).forEach(function(key){ if (mktoFields[key] === "") delete mktoFields[key]; }) form.setValuesCoerced(mktoFields); });

 

1 reply

SanfordWhiteman
SanfordWhitemanAccepted solution
New Participant
January 31, 2023

That's expected behavior. If the field is empty and you prefill an empty value, that's still a valid value.

 

You can remove the empty values from the fields object if you want, although I'd caution that there are situations where Pre-Filling the empty value is appropriate.

MktoForms2.whenReady(function(form) { Object.keys(mktoFields).forEach(function(key){ if (mktoFields[key] === "") delete mktoFields[key]; }) form.setValuesCoerced(mktoFields); });

 

Philippe_Sanchi
New Participant
February 1, 2023

Thanks @sanfordwhiteman 
Your update works like a charm ! It is perfect.  😀