Pardot form syncing issue 255 character

Fixing the Pardot form sync issue: 255-character limit

If you’ve worked with Pardot’s form handlers then you know that to sync with Salesforce, text areas cannot go exceed the 255-character limit. Which, if gone over, results in syncing errors with Salesforce, meaning any leads coming through will get stuck in Pardot.

A potential Pardot fix

After dealing with this issue for a number of months, we have managed to find a simple solution that completely solves the problem without the need for any other code.

A popular fix we have found online counts the characters and lets the user know when they are over the 255-character limit and disables the submit button. While this does work, pasting more than 255 characters gets around this and allows forms to be submitted with more than 255 characters.

A simple solution: maxlegth

Both input and textarea fields in HTML can make use of the maxlegth attribute. Maxlength allows the maximum length in characters to be set directly into the element, preventing more than the number of characters allowed to be entered, even when pasting.

So now that we a solution, insert the attribute and its value into the element shouldn’t be too hard. The following two lines of code does the job perfectly.

<script>    
    const target = document.querySelector(".limit textarea");
    target.setAttribute('maxlength',255);
</script>

Let us explain how the above code works.

The top line looks for an element on the page with a class name limit and then a <textarea> element nested within. The second line inserts an attribute, in this case maxlength with a value of 255, which translates into maxlength=”255″.

Add the code to the Pardot form

During the usual setup process, on the Look and Feel tab there is a section called Below Form. Select this and click on the icon above the text editor that looks like <>. Copy and paste the code from above. Hit save and test your form. It should now be working, and you should no longer have issues with forms being filled out with more than 255 characters.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *