We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38525
    • 26 Posts
    Hi all,

    I'm really stuck on this one... I have a chunk, containing a FormIt form that works fine when I use it in a template. But when I use a TV with an output filter to call the same chunk, things go wrong.

    The TV call with output filter:
    [[*contact_form_toggle:is=`on`:then=`[[$contactForm]]`]]


    The contactForm chunk:
    [[!FormIt?
       &hooks=`spam,email,redirect,FormItAutoResponder`
       &emailTpl=`cf_contactMailTpl`
       &emailSubject=`Ingevuld contactformulier`
       &emailTo=`[email protected]`
       &redirectTo=`52`
       &fiarTpl=`cf_autoResponderTpl`
       &fiarSubject=`Uw bericht aan xxxxx`
       &fiarToField=`cf_email`
       &fiarFrom=`[email protected]`
       &validate=`cf_naam:required,cf_email:email:required,cf_bericht:required:stripTags`
    ]]
    <div class="ddfmwrap">
      <form class="ddfm" method="post" action="[[~[[*id]]]]" enctype="multipart/form-data">
      <input type="hidden" name="cf_workemail" value="" />
    
      <div class="section">
        <h2>Uw gegevens</h2>
        [[!+fi.error_message:notempty=`<p>[[!+fi.error_message]]</p>`]]
        <p class="fieldwrap"><label for="cf_naam"><span class="required">*</span> Naam</label>[[!+fi.error.cf_naam:notempty=`[[!+fi.error.cf_naam]]`]]<input class="fmtext" type="text" name="cf_naam" value="[[!+fi.cf_naam]]" /></p>
        <p class="fieldwrap"><label for="cf_telefoon">Telefoonnummer</label><input class="fmtext" type="text" name="cf_telefoon" value="[[!+fi.cf_telefoon]]" /></p>
        <p class="fieldwrap"><label for="cf_email"><span class="required">*</span> E-mail adres</label>[[!+fi.error.cf_email:notempty=`[[!+fi.error.cf_email]]`]]<input class="fmtext" type="text" name="cf_email" value="[[!+fi.cf_email]]" /></p>
        <p class="fieldwrap"><label for="cf_bericht"><span class="required">*</span> Uw vraag of opmerking</label>[[!+fi.error.cf_bericht:notempty=`[[!+fi.error.cf_bericht]]`]]<textarea class="fmtextarea" name="cf_bericht" cols="20" rows="6">[[!+fi.cf_bericht]]</textarea></p>
      </div>
    
      <div class="submit"><input type="submit" name="cf_submit" value="Verzenden" /></div>
    
      </form>
    </div>
    


    And now comes the fun part: I've narrowed it down to the "@" symbols. If you leave them out of the FormIt call, everything works again, put 'em back in and the form won't show...

    Does anyone have a clue to what's going on here?? Is this a bug, or am overlooking something here?

    Greetings,
    Hugo
      • 38525
      • 26 Posts
      By the way, I'm using 2.2.0-pl2 and the latest version of FormIt...
        • 36572
        • 20 Posts
        Hi!

        The problem is the output filter. We had the same problem. We build a snippet to do check and used $modx->getChunk();

        So in your case
        Snippet : showForm
        if(intval($toggle) === 1){ return $modx->getChunk($tlp);}else{return false;}


        [[!showForm? &toggle=`[[*contact_form_toggle]]` &tpl=`contactForm`]]


        (I always use an int to check, less room for a typo);

        Success
          Developer @ Sterc bureau voor internet & marketing
          • 44740
          • 4 Posts
          Thaaaaaaaaank youuuuuuuuuu!!!!!!!!!!