Why am I getting random spaces in my output from a complex Gravity Forms customisation!?

Fao @alexander Rohmann

Hi Alex.

If you can, it would be great if you could have a quick play with the product recommendation page on the site I sent you details for..

I’m getting random spaces in the output page and also the email. It doesn’t happen every time (prob about 70% of the time) and there are usually 1 or 2 throughout the content.

All very weird – It’s randomness makes it hard to know where to start with it!

Many thanks


  • Alexander
    • DEV MAN’s Mascot

    Hi @martin,

    I tried out the form, and got a copy of the email. It happened in a section where 3 products were recommended. The two previous sections looked fine, but they only showed one product.

    The issue is that subsequent products are creating a whole new HTML table. So the tables begin to nest, which is causing all the extra blank space to the right.

    You’ll just want to double check your template code to make sure it’s adding a new table row with each product, instead of filling the cell with a new table altogether.

    Best regards

  • Martin
    • Site Builder, Child of Zeus

    Hi @alex

    Thanks for looking into this.

    I’ll check out the nested tables in the template file but I think this may be a separate issue…

    Please check this screenshot:


    It shows some spaces amid words in the email where they shouldn’t appear. It also shows the post excerpt which is what is being displayed in the email. You can see that it looks fine in the excerpt editor but weirdly, these spaces appear in the words in the email!?

    Like this:

    due to the => d ue to th e

    Even weirder is that the spaces appear in randomly different places in the email each time the form is used (although simply refreshing the submit page on the site generates the exact same email with spaces in the same places – you need to go back to the start of the form and submit again to see the space appear differently).

    Occasionally the spaces even appear inside html tags, breaking them and making broken, invalid tags appear in the email content..

    I’m totally lost with this – its randomness makes no sense to me??!

    Thanks again


  • Alexander
    • DEV MAN’s Mascot

    Hey @martin,

    Ok, sorry I missed that one the first time around. If you’re getting these spaces within tags and other places, it could be an encoding issue.

    When you added the “excerpts” and other content, did you do this manually? Or was it imported automatically somehow?

    Also, are you generating this email in code yourself, or are you using another plugin? If it’s possible, it might be beneficial to have the same code just output to an html page rather than an email. This way we can eliminate some steps, and see if it’s the original HTML causing the problem, or it it happens after it’s been sent as an email.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.