We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23299
    • 1,161 Posts
    I am trying to build a basic contact page that allows folks to send email messages with a secure semi spam proof form.

    I have been trying to get the basic eForm to work and have spent hours on it but it it not working for me.

    I want a simple, no bells and whistles system that is hopefully straightforward to add to my content page. I have a thread running on the eForm page but am wondering if there is a simpler alternative to eForm that I could try?

    Thanks!
      • 33372
      • 1,611 Posts
      eForm is pretty simple, especially if you just copy and paste one of the examples from the wiki and work from there. I find it makes it easier for me to create any sort of form in less time. But there are other options you might want to look at, including SPForm.
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Here’s a contact form setup I use.

        Snippet call:
        [!checkField!]
        <p>
        <span class="Normal">Your ideas and suggestions are welcome!</span>
        </p>
        [!eForm? &formid=`CommentEn` &tpl=`CommentFormEn` &to=`[email protected]` &subject=`Contact Form Submission` &replyto=`Email` &report=`CommentReport` &eformOnValidate=`checkField`!]

        Note the checkField snippet before the eForm snippet.

        The checkField snippet (this makes sure the field is empty)
        function checkField(&$fields,&$vMsg,&$rMsg) {
            if(!empty($fields['Last__Name'])) {
                return false;
            } else {
            return true;
            }
        }


        The CommentForm chunk (this is a multilanguage site, so I have En and De versions)
        [+validationmessage+]
        <form id="CommentEn" action="[~[*id*]~]" method="post">
        <fieldset class="fields">
        <label for="Email">Your email:<span class="required">*</span></label>
        <input type="text" name="Email" id="Email" class="text" eform="Email:email:1" />
        <label for="Name">Name:<span class="required">*</span></label>
        <input type="text" name="Name" id="Name" class="text" eform="Name::1" />
        <input type="text" name="Last__Name" id="LastName" size=30 autocomplete="off" eform="LastName::0" />
        <label for="Subject">Subject:<span class="required">*</span></label>
        <input type="text" name="Subject" id="Subject" class="text" eform="Subject::1" />
        <label for="Comments">Comments:<span class="required">*</span></label>
        <textarea name="Comments" id="Comments" class="textarea" eform="Comments::1" /></textarea><br />
        <input type="submit" name="submit" id="submit" class="button" value="Send" />
        </fieldset>
        </form>

        The report chunk:
        <strong>Contact / Comments</strong>
        
        <p><strong>Name:</strong> [+Name+]</p>
        <p><strong>Email:</strong> [+Email+]</p>
        <p><strong>Subject:</strong> [+Subject+]</p>
        <p><strong>Comments:</strong> [+Comments+]</p>
        

        And the CSS to style it all, plus hide the "security" field:
        #center form {
            margin:20px 0 20px 20px;
        }
        #center fieldset{
            border:none;
            padding:10px;
            margin:20px 0;
        }
        #center legend {
            font-weight:bold;
        }
        #center label {
            width:150px;
            margin-left:10px;
            text-align:left;
        }
        #center fieldset.radiofields label{
            width:150px;
            margin:0 5px;
        }
        #center fieldset.radiofields input.radio{
            margin-right:5px;
        }
        #center input.text, #center textarea {
            display:block;
            margin-left:10px;
            margin-bottom:10px;
            width:300px;
        }
        #center form br {
            clear:left;
            line-height:1px;
        }
        #center input.button {
            font-size:1.2em;
            margin-left:150px;
            padding:2px;
            color: #ffffff;
            background: #000060;
            border: 1px solid #000060;
            text-align:center;
            display: inline;
        }
        div.errors{
            color:red;
            padding:6px 10px;
            margin-left:15px;
        }
        span.required{
            color:red;
        }
        #CommentEn #LastName, #CommentDe #LastName{
            position:absolute;
            text-decoration:underline;
            background-color:#CC0000;
            left:0px;
            top:-500px;
            width:1px;
            height:1px;
            overflow:hidden;
        }
        
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 33372
          • 1,611 Posts
          I use Susan’s checkField anti-spam function also, and it cuts the spam to almost zero!
            "Things are not what they appear to be; nor are they otherwise." - Buddha

            "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

            Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
            • 3749
            • 24,544 Posts
            @Photowebmax,

            Iirc, you were trying out SPForm a while back, which sounds like what you’re describing and is *extremely* spamproof even without all the options turned on. On my Bobsguides site, I have yet to receive a single piece of spam even though the url is in my sig.

            Did SPForm not meet your needs? If so, I could use some feedback on it. I’m just getting ready to put it in the Repository.

            Bob
              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
              • 23299
              • 1,161 Posts
              Susan,

              I created a new test Contact page to try out your system.

              I spent about 40 seconds creating the snippet call you used, the new snippet and the two chunks. I also added the CSS to my template. I then tested the page and BAM it works perfectly first time!!!

              I hit send on the page, I get the thankyou message and when I retrieve my email all the fields and content are there.

              Very interesting, especially after going round and round with the documented Example for eForm. I tried to get that working but could never get it all lined up. I kind of wish these major snippets had a basic cut and paste procedure to get you going before addressing any custom work begins.

              THANK YOU!

              I might try some tweaking to the CSS though.

              Max
                • 23299
                • 1,161 Posts
                Bob,

                I did try out SPForm when I was messing around with MODx locally while using MAMP.

                Now that I was moving on with real project I thought I might take a look at eForm as it seems so popular. I copied all the code from the basic Example but the eForm would not work for me. I had several issues, some of which I resolved but the only text characters present in the body of the retrieved emails was "eFeedBackReport". Reading the search archives was frustrating as some of the examples did not match what I was using.

                I sort of stuck to it like a bulldog as I wanted to get the thing to work. I was going to take another look at the SPForm when Susan posted her code which was a snap to implement and worked great first time. The only issue I recall with SPForm was that I was not receiving any emails, but I am sure that was due to the fact that I was running the MODx install locally without a live SMTP system running. The rest of it worked well though.

                I would still like to know what I am doing wrong with eForm, even though I might not use it. Its probably some tiny thing that would be obvious to others but not to me... Figuring out some of this stuff is a strange mixture of frustration, agony, accomplishment,  and enjoyment...
                  • 33372
                  • 1,611 Posts
                  Quote from: Photowebmax at Mar 15, 2008, 05:20 PM

                  ...the only text characters present in the body of the retrieved emails was "eFeedBackReport".
                  That sounds to me as if you didn’t name your report chunk exactly the same as you typed it in the snippet call (note: case matters).
                    "Things are not what they appear to be; nor are they otherwise." - Buddha

                    "Well, gee, Buddha - that wasn&#39;t very helpful..." - ZAP

                    Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
                    • 23299
                    • 1,161 Posts
                    Actually the text I was getting was eFeedbackReport...

                    But you are spot on with the case sensitive issue though. Thanks! Not sure how it happened but after trying differing things and copying from the example(s) I did find that one letter in the chunk name was capitalized when the snippet call action was not. I also had to change the [+Name+] vs [+name+] in the two chunks. So after going through this again it now works!

                    So after a long morning of not getting a email form to work I now have TWO different systems working... Go figure...

                    Max
                      • 27330
                      • 884 Posts
                      just create another snippet to display each form randomly so you can use both smiley