Progressive profiling breaking on number field

SanfordWhiteman
Level 10 - Community Moderator

Re: Progressive profiling breaking on number field

Again, check your browser console:

pastedImage_0.png

This fatal error fires every time numeric field changes. It comes from this extra custom form behaviors script you're loading for some reason (not from Marketo's code):

    https://business.gogoair.com/ScriptResource.axd?d=x6wALODbMJK5e0eRC_p1LQVbFzXKuOIGpQVfJZ0u6_rz9I...

Because of the fatal error, the form validation errors out and the form cannot be posted to Marketo.

The technical cause is that that extra script overloads the native String#trim method (which is horrendous practice, since it's a standard ECMAScript method present in all browsers, even pre-modern browsers).

The trim method is called by the Forms 2.0 library, as is perfectly reasonable. But you've replaced it with an incompatible method that might at first glance appear to be harmless and equivalent in functionality to the native method.

String.prototype.trim = function () {

  return this.replace(/^\s+|\s+$/g, "")

};

This trim will work fine if called as a method on a String.

Unlike the native method, it will not work if applied to a Number.

pastedImage_9.png

This is because the native method coerces its input to a String before trimming it. Strings have replace. Numbers don't.

Yet again I suggest you close out the Marketo case. They aren't going to figure this stuff out as they don't have the experience.

SanfordWhiteman
Level 10 - Community Moderator

Re: Progressive profiling breaking on number field

Same applies to checkbox fields, which are stored as an Array, not a String, so again the third-party code breaks because of its bad trim (re)implementation:

pastedImage_1.png

Again the problem has nothing to do with Marketo. Overwriting native prototype methods will have consequences. Never do it unless there's some specific bug (relative to the standard implementation) you need to fix in only one browser, or to accomplish a debugging need that you can't do any other way.

P.S. I also noticed your email validator doesn't allow plus addresses, which are perfectly valid addresses used by GMail/GSuite users:

pastedImage_2.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Progressive profiling breaking on number field

Katie Blakey​ bumping this so you see the 3rd-party code that's causing your problem.​

Anonymous
Not applicable

Re: Progressive profiling breaking on number field

Thanks Sanford! Our development team didn't have a chance to look at this today, so I'll bug 'em first thing in the morning. We just went through a website redesign, so I'm not sure if that 3rd party code came from us or one of our partners.