We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52621
    • 12 Posts
    Hey there, I have troubles with using FormIt. Just want to make a simple contact form and used a sample code. Everything seems to work, but only the e-mail field makes problems. There always appears the error message "This is a required field.", no matter what mailadress I'm filling in.

    Here is my code - any ideas? Help would be great, I'm stuck here.
    It is exactly the same code as here http://www.cmstricks.com/demos/formit-demo and here it works.
    But not for me, when I paste this code into my ModX.

    <link rel="stylesheet" href="assets/samples/css/bootstrap-responsive.min.css">
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    
    <!-- Optional theme -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
    
    <!-- Latest compiled and minified JavaScript -->
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
    
    <div class="container">
     
    [[!FormIt?
       &hooks=`email`
       &emailFrom=`donotreply[@]youremail.com`
       &emailTpl=`MyEmailChunk`
       &emailTo=` [email protected]`
       &emailSubject=`Your Subject Goes Here`
       &validate=`name:required,
          email:email:required,
          comment:required:stripTags`
          &successMessage=`<div class="alert alert-success marginTop25">
          <button type="button" class="close" data-dismiss="alert">×</button>
          <h3>Your comment has been submitted successfully, please check your email.</h3>
        </div>`
        &validationErrorMessage=`<div class="alert alert-error">
          <button type="button" class="close" data-dismiss="alert">×</button>
          <h3>Please review the following errors:</h3>
            <ul>
                [[!+fi.error.name:!empty=`<li><a href="[[~[[*id]]]]#name">Name is a required field</a></li>`]]
                [[!+fi.error.email:!empty=`<li><a href="[[~[[*id]]]]#email">Email is a required field</a></li>`]]
                [[!+fi.error.comment:!empty=`<li><a href="[[~[[*id]]]]#comment">Comment is a required field</a></li>`]]
            </ul>
        </div>`
    ]]
     
    [[!+fi.validation_error_message:!empty=`
        <div class="alert alert-error marginTop25">
          <button type="button" class="close" data-dismiss="alert">×</button>
          <h3>Please review the following errors:</h3>
            <ul>
                [[!+fi.error.name:!empty=`<li><a href="[[~[[*id]]]]#name">Name is a required field</a></li>`]]
                [[!+fi.error.email:!empty=`<li><a href="[[~[[*id]]]]#email">Email is a required field</a></li>`]]
                [[!+fi.error.comment:!empty=`<li><a href="[[~[[*id]]]]#comment">Comment is a required field</a></li>`]]
            </ul>
        </div>`]]
         
        [[!+fi.successMessage]]
     
         
    <div class="well marginTop25">
        <form action="[[~[[*id]]]]" method="post">
            <div class="[[!+fi.error.name:notempty=`control-group error`]]" id="name">
                <label for="name">Name: [[!+fi.error.name:notempty=`<span class="label label-important">This is a required field.</span>`]]</label>
                <div class="controls">
                    <input type="text" name="name" value="[[!+fi.name]]" class="input-block-level">
                </div>
            </div>
     
            <div class="[[!+fi.error.email:notempty=`control-group error`]]" id="email">
                <label for="email">Email: [[!+fi.error.email:notempty=`<span class="label label-important">This is a required field.</span>`]]</label>
                <div class="controls">
                    <input type="text" name="email" value="[[!+fi.email]]" class="input-block-level">
                </div>
            </div>
     
            <div class="[[!+fi.error.comment:notempty=`control-group error`]]" id="comment">
                <label for="comment">Comment: [[!+fi.error.comment:notempty=`<span class="label label-important">This is a required field.</span>`]]</label>
                <div class="controls">
                    <textarea name="comment" cols="30" rows="10" value="[[!+fi.comment]]" class="input-block-level"></textarea>
                </div>
            </div>
     
            <input type="submit" value="Submit" class="btn btn-primary">
      
        </form>
         
        </div>
     
    </div>
    
    [ed. note: k-a-t-i last edited this post 6 years, 11 months ago.]
      • 52621
      • 12 Posts
      Hey there,
      luckily I could get the form to work.
      Now I get a success notice, but the problem now is, that the mails are note arriving.
      What is the difference between the emailFrom and emailTo? Is the emailFrom only a placeholder or something?
      I have hear some problems with forms cause by any server adjustments...
      Can someone please help me to solve this problem?

      Thanks and Br.
      K-A-T-I
        • 52621
        • 12 Posts
        Hey there. PROBLEM IS SOLVED.