We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 13583
    • 7 Posts
    JarlThorfinn Reply #1, 10 years ago
    Hi,

    I've upgraded four sites to Evo 1.0.13, which upgrades eFrom to 1.4.5. On all the sites I've noticed a problem with the contact forms now displaying br tags in sent emails, instead of new lines.

    For example, I have a form with the following report tpl:

    <p>This is a response sent by [+names+] using the contact form on your website:</p>
    <table>
    <tr valign="top"><td>Name:</td><td>[+names+]</td></tr>
    <tr valign="top"><td>Email:</td><td>[+email+]</td></tr>
    <tr valign="top"><td>Phone:</td><td>[+phone+]</td></tr>
    <tr valign="top"><td>Enquiry:</td><td>[+enquiry+]</td></tr>
    </table>
    <p>You can use this link to reply: <a href="mailto:[+email+]?subject=RE:[+subject+]">[+email+]</a></p>

    The form then outputs emails in the form:

    This is a response sent by Person Name using the contact form on your website:
    
    Name:     Person Name
    Email:    [email protected]
    Phone:    +44 12345 123123
    Enquiry:  Hi, <br /> <br />This is a test email using the form on the website. <br /> <br />Your sincerely, <br />Person Name
    
    You can use this link to reply: [email protected]

    In the html source for the email the code for the tables is fine, but the br tags have been converted to & l t ; br / & g t ; & l t ;
    This isn't an issue for me on my personal sites, but for clients it would be nicer to display the line breaks correctly.

    Can anyone please advise if this is a bug, or perhaps a security feature, in the upgraded version of eForm?

    Many thanks
    • Could you post the code for the enquiry form field please and the eForm call?
        • 13583
        • 7 Posts
        JarlThorfinn Reply #3, 10 years ago
        Quote from: Jako at Mar 19, 2014, 12:07 PM
        Could you post the code for the enquiry form field please and the eForm call?

        Hi Jako, Thanks for looking into this.

        The eForm call is:

        [!eForm? &formid=`ContactForm` &tpl=`ContactForm` &from=`((email))` &fromname=`((name))` &replyto=`((email))` &to=`[email protected]` &report=`ContactReport` &gotoid=`6` &vericode=`1` &subject=`Website Contact Form Enquiry`!]

        The code for the enquiry form, in the ContactForm tpl, is:

        <textarea id="enquiry" name="enquiry" rows="6" required="required" eform="Your Message:html:1"></textarea>
        • Posting html is allowed only if you enable it with &allowhtml=`1` in 1.4.5. But only do that if you really really want it.

          You could change the eform tag better to eform="Your Message:string:1" (http://rtfm.modx.com/extras/evo/eform#eForm-DatatypesandFormatting)

            • 13583
            • 7 Posts
            JarlThorfinn Reply #5, 10 years ago
            Many thanks Jako. I think the string option will be fine for these sites (though it does strip the new lines / line-breaks).
            • Thanks for pointing to a bug: htmlspecialchars_decode should have been executed during sending html mails (&sendAsText=`0` – the default). But it was executed during sending text mails.

              Fixed here: https://github.com/modxcms/evolution/commit/5738f4c7b9dcc4d33b41e432bb5bc82fca4019f4

              eform="Your Message:html:1" should work as expected now. Stripping all html tags without &allowHtml=`1` and replace line breaks with BR tags.
                • 45415
                • 14 Posts
                for a certain use (editing a database)
                I need &allowHtml=`1`
                without replacing line breaks with BR tags.
                Is there a way without changing the core?

                I used eform 1448 till now but wanted to upgrade to the newest version.
                  • 45415
                  • 14 Posts
                  eform 1448 does not work any more with modx evo 1.2.1
                  There arrises an error "GPC Array nested too deep!"
                    • 13226
                    • 953 Posts
                    @androme16

                    If you think this is a bug, please report it on GitHub, not here in the forum