We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6902
    • 126 Posts
    For some reason I’m getting 404s when I try to go file a bug with FormIt on github... so here it is...

    in the fihooks.class.php-->line 295:
    <?php
    $this->modx->mail->set(modMail::MAIL_BODY,$emailHtml ? nl2br($message) : $message);
    


    $emailHtml has not been defined, thus you never get your automatic HTML line breaks.

    To correct, somewhere above, I added:
    <?php
    $emailHtml = $this->modx->getOption('emailHtml',$this->formit->config, true);
    
      • 6902
      • 126 Posts
      Quote from: debussy at Jan 28, 2011, 09:18 AM

      $emailHtml has not been defined, thus you never get your automatic HTML line breaks.

      Actually, it occurred to me that there really should be 3 effective settings: plain, html, and complex html... someone doing basic bold, italic, and the like would appreciate not having to add in all the BR tags... but someone doing a complex html form probably wouldn’t want a bunch of BRs barfed all over their design...


      This "bug" also applies to the FormItAutoResponder snippet.
        • 8872
        • 41 Posts
        Maybe silly question: how to automatically scroll down to error message after clicking submit (and obviously error appears), because my form is placed way down on the bottom of the page? It is easy with quip: just adding custom template+anchor, but not sure how to do it here.
          • 34022 ☆ A M B ☆
          • 91 Posts
          On my Revo 2.1 RC3 install, I have a problem with custom validators returning TWO error messages, one exactly as intended and one holding just the "return" value returned from the snippet. I have created a snippet to check that the field is both not empty and does not match a particular string:

          <?php
          $value = trim(''.$modx->getOption('value',$scriptProperties,''));
          $param = trim(''.$modx->getOption('param',$scriptProperties,''));
          $key = $modx->getOption('key',$scriptProperties,'');
          $field_name =  trim(str_replace("*", "", $param));
          if (!(strcmp($value,$param)) || empty($value)) {
             $success=false;
          } else {
            $success=true;
          }
          if (!$success) {
            $validator->addError($key,$field_name.' is required!');
          }
          return $success;
          


          This works exactly as intended but returns the following in the error placeholder:

          <span class="error">Email is required!</span><span class="error"></span>


          Returning zero (0) instead of "false" results in:

          <span class="error">Email is required!</span><span class="error">0</span>


          I have tried alternating various return values, but the second error is always returned.

          UPDATE: By the way, the relevant FormIt parameters are:

          &customValidators=`finot` 
          &validate=`full_name:finot=`Full Name *`,
          phone:finot=`Phone *`,
          email:finot=`Email *`:email,
          message:finot=`Message *`,
          blank:blank`


          My error span CSS has a border and display: block, so it shows up on the site. Anything I can do to get rid of the extra error?
            WebsiteZen.com - MODX and E-Commerce web development in the San Francisco Bay Area
            • 34022 ☆ A M B ☆
            • 91 Posts
            Update: I fixed the CSS problems by setting [tt]&errTpl=`[[+error]] `[/tt] and enclosing all of the errors in the span tag like so:

            [[!+fi.error.[[+name]]:notempty=`<span class="error">[[!+fi.error.[[+name]]]]</span>`]]


            But I guess this is just a quick fix and probably still needs a full solution.
              WebsiteZen.com - MODX and E-Commerce web development in the San Francisco Bay Area
              • 2048
              • 15 Posts
              Great extra thanks !!

              But i want to have the email (input in a form’s field ) as Replyto for the email generate for a contact form.

              how do this ?

              i was thinking make like the subject but need to modify fihooks.class.php if i understand ? or is it another soluce ?

              Edit : ok i found another soluce in looking fihooks.class.php

              must use name of ’email’ for the field containing visitor’s email and the emailfrom take value of the visitor email, and replyto too

              no need to tweak formit
              could be great to mention that in documentation wink
                coding Java Android and NDS