We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 20413
    • 2,877 Posts
    Im about installing alpha local MUCH because of YOU and posts like this ----> http://modxcms.com/forums/index.php/topic,31583.0.html smiley

      @hawproductions | http://mrhaw.com/

      Infograph: MODX Advanced Install in 7 steps:
      http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

      Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
      http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
      • 27330
      • 884 Posts
      I’m getting this error under 0.9.6.3RC2, any ideas what it can be?

      Error: 	Invalid argument supplied for foreach()	 
        Error type/ Nr.: 	Warning - 2	 
        File: 	/home/roomd3/public_html/modx/assets/snippets/spform/spform.inc.php	 
        Line: 	229	 
        Line 229 source: 	foreach($options as $key => $description) { 
        • 27330
        • 884 Posts
        sorry had blank contacts.cfg.php file somehow.
          • 27330
          • 884 Posts
          I have an issue with spform, when a form submits the URL changes to spfresponse.?err=1 , resulting in a new page.  spfresponse.htm?err=1 gives me the correct Thank You page. anywhere to look?

          also for customizing the form fields, I can see in spform.inc.php the form but where do I change the email sent to include my add on fields?

          Thanks in advance.
            • 3749
            • 24,544 Posts
            Quote from: sinbad at Dec 28, 2008, 03:14 AM

            I have an issue with spform, when a form submits the URL changes to spfresponse.?err=1 , resulting in a new page. spfresponse.htm?err=1 gives me the correct Thank You page. anywhere to look?
            This happened to me once and I can’t for the life of me remember why. Try turning on spfDebug and checking what ResponseURL is set to. If you’re previewing from the Manager, that could be causing the error. Try it from another browser as non-admin user.


            also for customizing the form fields, I can see in spform.inc.php the form but where do I change the email sent to include my add on fields?

            This is where eForm is superior. SPForm is simpler, but not very flexible with respect to the form. With SPForm, you’d have to add your fileds to the form in the code in SPForm.inc.php and then (in SPFormProc.inc.php) pull them from the $_POST data and append them to the $content variable (around line 515).
              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
              • 6947
              • 8 Posts
              Quote from: BobRay at Dec 28, 2008, 07:43 AM


              This is where eForm is superior. SPForm is simpler, but not very flexible with respect to the form. With SPForm, you’d have to add your fields to the form in the code in SPForm.inc.php and then (in SPFormProc.inc.php) pull them from the $_POST data and append them to the $content variable (around line 515).

              This is in fact exactly what I am doing - i know eform is more flexible but i only need one extra bit and i have already set up my site with SPForm so i thought i would give it a bash.

              in my spform.inc.php i added
              echo '<p><span class="spf_prompt">'.$spf_lang['marketing'].'</span><br />';
              echo '<span class="spf_normal_input"><select name="marketing">';
              echo '<option value="None">Please Select...</option>';
              echo '<option value="Printed">Printed Advert</option>';
              echo '<option value="Yell">Yell.com</option>';
              echo '<option value="Search">Internet Search</option>';
              echo '<option value="Word">Word of Mouth</option>';
              echo '<option value="Other">Other</option>';
              echo '</select>';
              


              so that i can have a drop down box of options and then in my spformproc.inc.php i added
              if(!empty($_POST['name']))
                  $content = $_POST['name'] .' '.$spf_lang['wrote'];
              $content .= preg_replace('/\r/', '', stripslashes($_POST['comments'])) . "\n" . "\n";
              $content .= "Marketing response: " ;
              $content .= $_POST['marketing'];
              
              $addlHeaders = empty($_POST['email'])? "" : "From: " . $_POST['email'] . "\n" .
                                                          "Reply-To: " . $_POST['email'] . "\n";

              to grab the marketing variable out of the POST data and append it to the body text of my email.

              For some reason though - the selection i pick from the drop down box (whatever it may be) refuses to appear at the bottom of my email. For I get:


              Deevee wrote: This is the text i want to send you
              Marketing response: 


              Any ideas what i might have missed?

              Thanks guys
              D

                • 3749
                • 24,544 Posts
                Have you tried just echoing $_POST[’marketing’]; where you’re trying to append it to the content, to see if it’s empty? If it’s not empty, I can’t see why it shouldn’t work.

                  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
                  • 29525
                  • 388 Posts
                  Hey Bob

                  I’m stumped trying to resolve this err=1 problem. The email is being delivered but I’m taken to my custom 404 page from this URL. It looks like its trying to go to the privacy policy page which is doc 35 and is a working page.
                  http://www.twptown.org/spfresponse?OrigRef=http%3A%2F%2Fwww.twptown.org%2Fprivacy-policy&err=1


                  I’ve verified the document IDs are correct and the documents are published.

                  $spformProcID = 31; // Doc ID of spformproc page
                  $spfResponseID = 32; // Doc ID of spfresponse page

                  With debug turned on, the following message appears in place of the contact form. This appears to be going to the mission page (ID 26).
                  ResponseURL: http://www.twptown.org/spfresponse?OrigRef=http%3A%2F%2Fwww.twptown.org%2Fmission


                  I’ve also replaced the code related to this to no effect.
                  It appears that you’ve uncovered a bug in SPForm that occurs when orig_referer is blank in the _POST.

                  This is fairly urgent, because this site just went live, we’re working out a few kinks, but I haven’t seen this problem before.

                  Here’s the url to the contact form.
                  http://www.twptown.org/contact-us

                  Any help would be tremendously helpful.

                  Thank you.
                    www.terrybarthdesign.com
                    • 3749
                    • 24,544 Posts
                    I’ve seen problems like this on some servers. They seem to be based on how the server formats the original referer variable.

                    The only thing I can suggest without a lot of debugging and hacking is to try replacing the code at the very end of spformproc.inc.php.

                    Comment out all of this.

                    // Redirect them to a response page
                    $spfResponseArg = "";
                    if(!empty($_POST['orig_referer'])) { // if it's there, create arg for spfresponse to take user back
                        $spfResponseArg .= "OrigRef=" . urlencode($_POST['orig_referer'].'"'); // needed for makeUrl
                    }
                    $responseURL = $modx->makeUrl($spfResponseID,'',$spfResponseArg,'full'); // $spfResponseID set in config file
                    
                    if(!empty($_POST['orig_referer'])) {
                        $responseURL = substr_replace($responseURL, '', strlen($responseURL)-3);  // strip trailing slash from original referrer string
                    }
                    if ($spfDebug) {
                        echo "ResponseURL: ".$responseURL.'<br>';
                    }
                    $modx->sendRedirect($responseURL,1);


                    Then add this:

                     // $spfResponseID set in config file
                    $responseURL = $modx->makeUrl($spfResponseID, '', '', 'full');   // $spfResponseID set in config file
                    $modx->sendRedirect($responseURL,1);



                    Then, remove the "take me back" link from the response page and just say thanks.

                      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
                      • 29525
                      • 388 Posts
                      Bob

                      Wow! Impressive! Works perfectly.

                      Thank you so much for the excellent and fast response!

                      Terry
                        www.terrybarthdesign.com