We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23018
    • 353 Posts
    I have spend a good part of the day tracking down a parsing problem causing a page containing a formit call to break.

    After rewriting the code a couple of times I finally found the problem.

    Any @ character inside my formit call is breaking the parsing of this particular chunk. If I remove all @ characters , everything is fine. If I even add a single one of them, everything after that character gets messed up in the most horrible way.

    A form without any email address to send your mails to is a bit pointless, so this is a real game stopper for me. sad

    I have checked, double checked and tripple checked for missing backticks. PLease have a look, If I'm missing something stupid:

    [[!FormIt?
    &hooks=`email,FormItAutoResponder`
    &store=`1`
    &placeholderPrefix=`fi.`
    
    &emailTpl=`kontaktformular_emailTpl_body`
    &emailFrom=`[email protected]`
    
    &emailSubject=`Nachricht vom Kontaktformular`
    
    &_emailTo=`[email protected]`
    &_emailCC=`[email protected]`
    
    &emailTo=`[email protected]`
    
    &fiarTpl=`kontaktformular_emailTpl_body`
    
    &fiarFrom=`[email protected]`
    &fiarSubject=`Nachricht über Kontaktformular.`
    &fiarReplyTo=`[[+fi.email]]`
    
    &fiarCC=`[email protected]`
    
    &validate=`nospam:blank,
    name:required,
    email:email:required,
    subject:required,
    text:required:stripTags`
    
    &successMessage=`
    <p>
      <i class="icon-ok"></i> Ihre Nachricht wurde erfolgreich versendet.
      Zur Erinnerung senden wir eine Kopie dieser Nachricht an ihre E-Mail Adresse.
    </p>
    `
    &validationErrorMessage=`
    <p>
      <i class="icon-warning-sign"></i> Ihre Formulareingaben sind unvollständig oder fehlerhaft.
      Bitte überprüfen Sie ihre Angaben in den <strong class="text-error">rot gekennzeichneten</strong> Formularfeldern.
    </p>
    `
    ]]
    




    I'm working on MACOS 10.6 (Snow Leopard) with Google Chrome, I have created quite a lot of forms on this machine, so I don't think this is related to client side soft- or hardware. (Update: I just checked with Win8/Chrome on a different machine, I get the same result).

    I also disabled CodeMirrow without any positive effect.

    This problem is not caused by FormIt itself. If I rename the snippet call, the problem is still there. Nevertheless I removed and reinstalled Formit. No effect.

    I wrote a custom snippet and passed an email address to this snippet. It didn't cause the page to break and the whole email address was displayed. Because of this, I'm fairly sure that there is another thing apart from the @ character causing this behaviour.

    Other things I did:

    I tried different Browsers (FF, Opera and even IE). No effect.
    I wrote the code in Komodo Edit and and pasted it into MODX. No effect.

    I don't know where to look next.

    System:
    I'm develloping on skytoaster (PHP 5.3.23, MySQL 5.5.30).
    My MODX Version is 2.2.6-pl (traditional)
    Database and collation are set to utf-8_general_ci.

    Any advice where to look next?

    Regards,

    pepebe
      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
      • 23018
      • 353 Posts
      Update: Today I updated MODX to 2.2.7. The problem is still there.
        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
        • 3749
        • 24,544 Posts
        It does sound like a character encoding issue. See this: http://bobsguides.com/convert-db-utf8.html
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 23018
          • 353 Posts
          Quote from: BobRay at Apr 25, 2013, 12:28 AM
          It does sound like a character encoding issue. See this: http://bobsguides.com/convert-db-utf8.html

          Thanks for your advice BobRay. I agree that this is very likely the symptom that's causing this problem. About the cause I'm still in the dark.

          Also thanks for your link I'll give it a try if I don't come up with a different explanation.

          In the meantime I found out that calling the snippet cached will remove the problem.

          So it doesn't work wih

          [[!FormIt? &emailTpl=`[email protected]` ]]

          but it works with

          [[FormIt? &emailTpl=`[email protected]` ]]

          I'm not sure what's the deeper meaning of this fact but I'm sure that a cached FormIt snippet can't be a goog idea.

          Regards,

          pepebe

          P.S. The problem is not caused by FormIt itself. It's something different. [ed. note: pepebe last edited this post 13 years, 5 months ago.]
            Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
            • 23018
            • 353 Posts
            Quick update: I tried several things but none of them worked. In the end I created a custom template with all the chunks and snippets I needed and the error was gone.

            From what I have learned this is related to calling the formit snippet uncached inside a nested structure of chunks and snippets. I still can't understand what is the exact reason in the context of my template but I have to move on. I hope I find the time to solve that puzzle at a later time.

            @BobRay: Thanks for your advice. I'll keep your conversion snippet in my list of handy things to have in cases of emergency.

            Regards,

            pepebe
              Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe