We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 38239
    • 5 Posts
    I have yet to find an answer or question for this.
    I am using the Formit snippet but I can not get this to call on my contact page.
    I am used to Joomla, Drupal, and wordpress i'm trying to learn Modx because it's flexability.
    How can I call this into my contact page?
    • Formit does not generate the form, you need to have your form on your page. Formit only processes the form submission.

      http://rtfm.modx.com/display/ADDON/FormIt
      http://codingpad.maryspad.com/2011/03/08/modx-revolution-for-complete-beginners-part-9-using-formit-for-contact-forms/
        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
        • 38239
        • 5 Posts
        I created a form called Contactus
        and tried to call it from a chunk into the contact us page using html but nothing
        This is the code i'm using for my snippet?


        <?php
        $snippetName='FormItBuilder_BasicExample';
        require_once $modx->getOption('core_path',null,MODX_CORE_PATH).'components/formitbuilder/model/formitbuilder/FormItBuilder.class.php';
        if (function_exists('FormItBuilder_BasicExample')===false) {
        function FormItBuilder_BasicExample(modX &$modx, string $snippetName) {




        //CREATE FORM ELEMENTS
        $o_fe_name = new FormItBuilder_elementText('name_full','Your Name');
        $o_fe_email = new FormItBuilder_elementText('email_address','Email Address');
        $o_fe_notes = new FormItBuilder_elementTextArea('comments','Comments',5,30);
        $o_fe_buttSubmit = new FormItBuilder_elementButton('submit','Submit Form','submit');

        //SET VALIDATION RULES
        $a_formRules=array();
        //Set required fields
        $a_formFields_required = array($o_fe_notes, $o_fe_name, $o_fe_email);
        foreach($a_formFields_required as $field){
        $a_formRules[] = new FormRule(FormRuleType::required,$field);
        }
        //make email field require a valid email address
        $a_formRules[] = new FormRule(FormRuleType::email, $o_fe_email, NULL, 'Please provide a valid email address');

        //CREATE FORM AND SETUP
        $o_form = new FormItBuilder($modx,'contactForm');
        $o_form->setHooks(array('spam','email','redirect'));
        $o_form->setRedirectDocument(5);
        $o_form->addRules($a_formRules);
        $o_form->setPostHookName($snippetName);
        $o_form->setEmailToAddress('[email protected]');
        $o_form->setEmailFromAddress('[[+email_address]]');
        $o_form->setEmailSubject('FormItBuilder Contact Form Submission - From: [[+name_full]]');
        $o_form->setEmailHeadHtml('<p>This is a response sent by [[+name_full]] using the contact us form:</p>');
        $o_form->setJqueryValidation(true);

        //ADD ELEMENTS TO THE FORM IN PREFERRED ORDER
        $o_form->addElements(
        array(
        $o_fe_name,$o_fe_email,$o_fe_notes,
        new FormItBuilder_htmlBlock('<hr class="formSpltter" />'),
        $o_fe_buttSubmit
        )
        );

        return $o_form;




        }
        }
        //Run the form construction function above
        $o_form = FormItBuilder_BasicExample($modx,$snippetName);
        if(isset($outputType)===false){
        //this same snippet was called via the email posthook
        $hook->setValue('FormItBuilderEmailTpl',$o_form->postHook());
        return true;
        }else{
        //Final output for form
        return $o_form->output();
        }
        • Ah, that's FormitBuilder, another matter altogether. Have you followed the instructions here http://modxrevo.datawebnet.com.au/formitbuilder-instructions/
            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
            • 38239
            • 5 Posts
            Oh ok no i've been looking for something like this to go bby.
            Thank you
              • 38239
              • 5 Posts
              Still avail.
              The only thing I can not understand how to call in snippets. I know I need to forget drupal and joomla but I just cant seem how to find out how to call the snippet it from a document
                • 3749
                • 24,544 Posts
                In revolution, just put a tag like the following in the document. The tag will be replaced by the return value of the snippet code:

                [[SnippetName]]


                If the value returned will change often (e.g., it returns the current time, or the result of some calculation with variables that may change), call it uncached, like this:

                [[!SnippetName]]




                ---------------------------------------------------------------------------------------------------------------
                PLEASE, PLEASE specify the version of MODX you are using . . . PLEASE!
                MODx info for everyone: http://bobsguides.com/MODx.html
                  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
                  • 18270
                  • 68 Posts
                  How did you end up going with the forms kvanconant? Did you get all your issues sorted in the end?
                  Feel free to shoot me a message with any issues here

                  http://modxrevo.datawebnet.com.au/contact-support/