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

    Im really sorry, very new to modx and making steady progress. Anyway, trying to get a basic form on my site working with FormIt, and am not getting very far. I’m basically trying to get sample form working, once this is wokring I can build up the additional fields I need. the code I have used so far is:

    [[!FormIt?
    &hooks=`spam,email,redirect`
    &emailTpl=`MyEmailChunk`
    &emailTo=`[email protected]`
    &redirectTo=`thankyou.html`
    &validate=`name:required, email:email:required, subject:required, text:required:stripTags, numbers:required, colors:required` ]]

    <h2>Contact Form</h2>
    [[!+fi.error.error_message:notempty=`
    <p>[[!+fi.error.error_message]]</p>
    `]] <form class="form" action="[[~[[*id]]]]" enctype="application/x-www-form-urlencoded" method="post"><input name="nospam:blank" type="hidden" /> <label for="name">Name: <span class="error">[[!+fi.error.name]]</span> </label><input id="name" name="name" type="text" value="[[!+fi.name]]" /> <label for="email">Email: <span class="error">[[!+fi.error.email]]</span> </label><input id="email" name="email" type="text" value="[[!+fi.email]]" /> <label for="subject">Subject: <span class="error">[[!+fi.error.subject]]</span> </label><input id="subject" name="subject" type="text" value="[[!+fi.subject]]" /> <label for="text">Message: <span class="error">[[!+fi.error.text]]</span> </label><textarea id="text" cols="55" rows="7" name="text">[[!+fi.text]]</textarea> <label>Numbers:[[+fi.error.numbers]] <select name="numbers"> <option selected="selected">Select an option...</option> <option value="one">One</option> <option value="two">Two</option> <option value="three">Three</option></select> </label><label>Colors:[[!+fi.error.colors]] <input name="colors[]" type="hidden" /> </label>
    <ul>
    <li><label><input name="colors[]" type="checkbox" value="red" /> Red</label> </li>
    <li><label><input name="colors[]" type="checkbox" value="blue" /> Blue</label> </li>
    <li><label><input name="colors[]" type="checkbox" value="green" /> Green</label> </li>
    </ul>
    <br class="clear" />[[!+FormIt.recaptcha_html]] [[!+fi.error.recaptcha]] <br class="clear" />
    <div class="form-buttons"><input type="submit" value="Send Contact Inquiry" /> </div>
    </form>



    I have created a chunk and called it "MyEmailChunk"
    with the following code
    This is the Formit Email Chunk.
    [[+name]] ([[+email]]) Wrote:
    [[+text]]


    Any advice would be greatly appreciated
    • It looks like you left the Rich Text Editor (RTE) or TinyMCE on for that page. The RTE will convert & to &amp; which breaks snippet calls. If you change the &amp; to & you should be good to go smiley
        Patrick | Server Wrangler
        About Me: Website | TweetsMODX Hosting
        • 4948
        • 33 Posts
        Thanks AMDbuilder,

        Thats worked embarrassed so new to this game, your help was very much appreciated.
        • Glad to be of assistance. If you need a getting started guide check out http://codingpad.maryspad.com/beginner-tutorials/ some great stuff.
            Patrick | Server Wrangler
            About Me: Website | TweetsMODX Hosting