We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5340
    • 1,624 Posts
    Just a small add-on (do not know if it was posted before or if there is another workaround)

    It is used when you are sending the email to different people but based on the selected subject. In my case the subject is a drop down list and based on the selection the email gets sent to the right person. In this case the subject is a numeric value (otherwise it won’t work with mail selector) and you do not want a number as your email subject

    Works the same as "mail selector" but requires coma separated values for the subject.

    [[eForm? &formid=`feedbackForm` &to=`[email protected],[email protected],[email protected],[email protected]` &mailselector=`subject` &tpl=`eFeedBackForm` &report=`eFeedbackReport` &thankyou=`eFeedbackThanks` &vericode=`0` &debug=`0` &subjectselector=`Feedback,Membership,Postcards,Buy+Sell`]]

    What you need to do to make it work

    1. Take the code below and replace the one in the eform.inc.php(~line 427)
    if ($mselector && $fields[$mselector]) {
    	$i = (int)$fields[$mselector];
    	$ar = explode(",",$to);
    	if ($i>0) $i--;
    	
    	if ($ar[$i]) $to = $ar[$i];
    	else $to = $ar[0];
    	
    	//check subject selector
    	if($sselector){
    		$sar = explode(",",$sselector);
    		if ($sar[$i]){ 
    			/*replace subject only if valid*/
    			$subject = $sar[$i];
    			$fields['subject'] = $subject;
    		}
    	}
    }

    2. Add this line to your eForm snippet

    ’sselector’ => isset($subjectselector)? $subjectselector:0,

    Put it under the mselector

    3. Call eForm as shown above.




      • 16063
      • 1 Posts
      This is most likely a server issue, but I need it fixed ASAP, and support with the server isn’t exactly the best.

      When I test the submit, I get a php parse error with this debug (sensitive information is genericized):

      PHP error debug
      Error: mail() [function.mail]: SMTP server response: 501 syntax: Recipient cannot contain a space (<Name <[email protected]>)
      Error type/ Nr.: Warning - 2
      File: E:\domain.com\html\manager\includes\controls\class.phpmailer.php
      Line: 438
      Line 438 source: $rt = @mail($to, $this->EncodeHeader($this->Subject), $body, $header);

      I do know that the server is using IIS (ugh...) and I am running ModX 0.9.6.1p2, with Eform 1.4.4, but I don’t know if Safe Mode is on or off, or other stuff like that.
        • 13629
        • 23 Posts
        Would it be possible to get an example of the simplest possible eForm, with the exact steps necessary to get it to work? Meaning, not just "here are the chunks and snippets," but "here’s what you do with the chunks and snippets."

        Thanks,
        Jason
          • 13583
          • 7 Posts
          Hi,

          I’ve successfully used the following snippet-call on several websites:

          [!eForm? &formid=`ContactForm` &tpl=`ContactForm` &fromname=`[+Name+]` &from=`[+email+]` &to=`[email protected]` &report=`ContactReport` &gotoid=`7` &vericode=`1` &subject=`Contact Form Submission From [(site_name)] WebSite`!]


          Using &fromname=`[+Name+]` and &from=`[+email+]` allows my clients to use the ’Reply’ button in their email app. However, on two new sites that I’m making, emails received through the contact form have no from name or email address - these two fields are entirely blank. If I delete &from and &fromname from the snippet-call the name and address reverts back to the default of from: ClientWebSiteAddress.com ([email protected]).

          Any ideas why the snippet call isn’t working properly on the new sites?

          I would really prefer emails from the contact form to be ’from’ the person sending the form - it makes for a much cleaner and easier to use inbox.

          Thanks in advance for any help,
          Cheers,
          Thor
            • 29181
            • 480 Posts
            Hey Jarl,
            I dont think you can do &from=`[+email+]` any longer. &fromname still works though. Using the replyto parameter means that when the person reading the mail clicks the reply button in their email client the address in the to field will be [+email+]

            [!eForm? &formid=`ContactForm` &tpl=`ContactForm` &fromname=`[+Name+]` &from=`[email protected]` &replyto=`[+email+]` &to=`[email protected]` &report=`ContactReport` &gotoid=`7` &vericode=`1` &subject=`Contact Form Submission From [(site_name)] WebSite`!]


            That is how I have been doing it lately.

            Hope that helps,
            Taff
              Adrian Lawley: www.adrianlawley.com
              • 31533
              • 8 Posts
              TobyL, thank you for great snippet! I’ve used it couple of times without any troubles. Keep up!

              But now i have to make some complicated form. I’ll skip all the architecture, and go straight to the point:

              In my &thankyou chunk i’m using Wayfinder, calling it like that:

              [!Wayfinder? &startId=`[+courses+]` &textOfLinks=`pagetitle` &outerTpl=`eFormOuterTpl` &rowTpl=`eFormRowTpl`!]
              


              And eForm just output that line. Wayfinder doesn’t start to work. Like &thankyou chunk isn’t parsed.

              To properly form [+courses+], i used Ditto in my &tpl, calling snippet consisting of three parts: top of form, ditto snippet call, bottom of form. That snippet is another unnesessary layer. I can say eForm doesn’t parse its chunks properly. Comparing to ditto -- in ditto chunks you can call any other snippet and it will work just fine, without adding another layer of prerendering snippets to get static chunk proper for eForm.

              How can i force eForm to let snippets work in eForm chunks?
                • 31533
                • 8 Posts
                I solve it.
                It is possible to call Wayfinder snippet in &thankyou uncached -- [[Wayfinder... ]]. It works.

                Now i need to call Wayfinder in my &report chunk. Again -- eForm doesn’t allow that. But there’s a way -- eformOnBeforeMailSent.
                [tt]
                [!eForm? &formid=`registerForm` &to=`[email protected]` &tpl=`eRegisterFormS` &eformOnBeforeMailSent=`ListOfCourses` &report=`eRegisterReport` &thankyou=`eRegisterThanks` &vericode=`1` &subject=`Запрос на обучение`!]
                [/tt]
                And ListOfCourses defined in &tpl snippet:
                <?php
                //ListOfCourses() converts tv courses (presented as Delimited List) to html chunk with list of courses with actual names
                function ListOfCourses(&$fields){
                	$fields['coursesList'] = implode(',',$fields['courses']);
                	$fields['coursesList'] = $modx->runSnippet(
                		"Wayfinder",
                		array(
                			"startId" => "415",
                			"includeDocs" => $fields['coursesList'],
                			"textOfLinks" => "pagetitle",
                			"outerTpl" => "eFormThanksOuterTpl",
                			"rowTpl" => "eFormThanksRowTpl"
                		)
                	);
                	return true; //else eForm will just stop
                }
                
                $formTop = $modx->getChunk("eRegisterFormTop");
                $dittoOutput = $modx->runSnippet(
                	"Ditto",
                	array(
                		"parents" => "415",
                		"depth" => "1",
                		"tpl" => "dittoCoursesListForEForm",
                		"display" => "all",
                		"orderBy" => "PriceNumber",
                		"filter" => "hidemenu,0"
                	)
                );
                $formBottom = $modx->getChunk("eRegisterFormBottom");
                return($formTop.$dittoOutput.$formBottom);
                ?>
                


                Well, everything made after docs/eform_example_events.htm included in distribution, except Wayfinder. Doesn’t work... Why eForm so agressive against other snippets?! smiley
                  • 25803 ☆ A M B ☆
                  • 721 Posts
                  Quote from: sottwell at Dec 02, 2007, 06:21 PM

                  Sorry about that; I couldn’t recall what the parameter was, and was in a hurry, and figured to at least give the reply that it is possible and there’s a parameter to do it.
                  &invalidClass=`invalidValue`
                  or any value you like.

                  How does this work exactly? For example if I have this:

                    <p><label for="fname">First Name
                    <span class="invalid">Please input your first name.</span>
                    </label>
                    <input type="text" name="fname" id="fname" eform="First Name:string:1" tabindex="3" />
                    </p>
                  


                  I obviously don’t want the invalid message to appear until it’s truly invalid. I can hide it with css but how is it triggered, if at all, by eForm?
                    • 5091
                    • 332 Posts
                    My old faviorate PHP form processor seems to have difficulty catching up with spammer’s trick because these days I kept getting spam (with multi-links of urls), so now I am seriously consider using eForm for a Modx’s site.

                    How spam-proof eForm is if I may ask?

                    Thanks!
                      • 5340
                      • 1,624 Posts
                      I think I found a nice buggy smiley eForm 1.4.4

                      403: foreach($formats as $fld) $hash .= isset($fields[$fld]) ? $fields[$fld] : ’’;

                      should be:

                      403: foreach($protectSubmit as $fld) $hash .= isset($fields[$fld]) ? $fields[$fld] : ’’;

                      I found this while trying to use the &protectSubmit
                      Eg: using it like this &protectSubmit=`name, email, anotheField` threw an error on that line so I changed it. It seems to work now

                      This discussion is closed to further replies. Keep calm and carry on.