We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28215
    • 4,149 Posts
    This is an auto-generated topic for FormIt 1.4.1-pl by splittingred.

    Brief Description:

    Automatically validate, parse and email forms. Redirect to thank you pages. Add your own hooks as Snippets to handle forms dynamically. Validate with custom Snippets. All is possible in FormIt, the new form processing Snippet for MODx Revolution 2.0.
    New in 1.4.1

    • Added sanity check for emailHtml property on email hook
    • Added sanity check for replyto/cc/bcc emails on email hook
    • Added ability to change language via &language parameter

    New in 1.4.0

    • Fixed bug with recaptcha and other hooks error display messages
    • Introduced &validate parameter for more secure validation parameters to prevent POST injection that could bypass validators
    • Added FormItIsChecked and FormItIsSelected custom output filters for easier checkbox/radio/select handling of selected values
    • Added &placeholderPrefix for FormIt snippet, defaults to `fi.`

    See the Official Documentation here:
    http://rtfm.modx.com/display/ADDON/FormIt
      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
      • 6214
      • 7 Posts
      Hi splittingred (or whoever else),

      I am not sure what I am doing wrong, but I have installed formit 1.4.1 on an install of modx revo 2.0.4, and it does the same thing at another site which is an install of the demo content site, without any changes on a revo 2.0.3...

      When the submit button is clicked nothing happens, it reloads the page absolutely blank... i could not find any threads that have the same issue... can anyone help?

      Thanks,

      Jeff

      EDIT: for anyone that has this issue... the problem was my server does not have the php multibyte extension, and it gave me no error when trying to us the multibyte function mb_ereg
        • 40045
        • 534 Posts
        Hi Shaun,

        thanks for this great snippet, I’m getting more and more into it and I love it =)...I recently had the need to disable the FileAttachment in email (I did a cURL FTP Upload Snippet btw. Hook, would like to contribute if you could package the whole thing, I have no idea how the transport.package thing works...), this was possible with a new FormIt snippet property I made, it’s called "emailAttachment=`boolean`" and I also had to change some lines in the fihook.class.php file:

                /* handle file fields */
                foreach ($fields as $k => $v) {
                	//xodmod: make it possible to disable email attachments
                	$attachment = (boolean)$this->modx->getOption('emailAttachment',$this->formit->config,true);
                	if ($attachment === true) {
        	            if (is_array($v) && !empty($v['tmp_name']) && isset($v['error']) && $v['error'] == UPLOAD_ERR_OK) {
        	                $this->modx->mail->mailer->AddAttachment($v['tmp_name'],$v['name'],'base64',!empty($v['type']) ? $v['type'] : 'application/octet-stream');
        	            }
        	        }
                }
        


        maybe you want to improve the code or take it in the next release...?

        keep up your good work!

        EDIT1: The above code didn’t work as expected...I have had this problem multiple times with Snippets, how can I pass booleans as booleans??? When I typecast the thing like above I always get a "1" = true, no matter what is really set... when I change it to a "string-construction" it works...but this is ugly/unclean/unprofessional =/

                /* handle file fields */
                foreach ($fields as $k => $v) {
                	//xodmod: make it possible to disable email attachments
                	$attachment = $this->modx->getOption('emailAttachment',$this->formit->config,'true');
                	if ($attachment === 'true') {
        	            if (is_array($v) && !empty($v['tmp_name']) && isset($v['error']) && $v['error'] == UPLOAD_ERR_OK) {
        	                $this->modx->mail->mailer->AddAttachment($v['tmp_name'],$v['name'],'base64',!empty($v['type']) ? $v['type'] : 'application/octet-stream');
        	            }
        	        }
                }
        



        EDIT2: I also recognized a repeatedly occuring error: ERROR @ /home/exodch/public_html/bern-derfilm/core/components/formit/model/formit/fivalidator.class.php : 104) PHP warning: Illegal offset type in isset or empty

        it’s the line:

        
                    /* handle checkboxes/radios with empty hiddens before that are field[] names */
                    if (is_array($v) && !isset($_FILES[$v]) && empty($v[0])) array_splice($v,0,1);
        


        any idea why this is?