We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Quote from: crosshairs at Jul 07, 2008, 01:43 PM

    Hi, I’m very much a newbie and found your installation instructions very clear and easy to follow. Thank you.

    I do have a little problem, tho - The form displays correctly and sends the email as it should, but after submitting, I’m taken to
    http://mysite.org/index.php?id=4&err=1

    where the page id=4 has no relation to the contact form...

    as I said, I’m rather new to this - am I missing something?

    Thanks

    On line 50 of spfconfig.cfg.php you need to put the document number of your spfResponse ("Thank-you") page. Maybe you have 4 entered there and there’s no document with that ID number?

    Bob
      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
      • 32556
      • 3 Posts
      What a great tutorial and great form. Since your asking for feedback and since I am very much a newbie at this, I figured I might as well. At this moment your request for feedback is the reason I finally registered with Modx. Here goes:

      Your tutorial stops just when it starts to get good. In your creation of the processing form you state:

      "Make a note of the document ID after you save the document (it’s in parentheses next to the document title in the document tree at the left side of the screen). We’ll need it later. "

      But we never get a chance to use it. There are several tweaks that have to be done and everything is explained very well in the readme file but not so much in the tutorial you have on your Bob’s Guides site. I imagine most just use the readme file and on they go but it might be helpful to "update" your website tutorial. Your work putting together a form like this is very much appreciated especially your patience with the readme file. Thank you!
        • 6018
        • 4 Posts
        On line 50 of spfconfig.cfg.php you need to put the document number of your spfResponse ("Thank-you") page. Maybe you have 4 entered there and there’s no document with that ID number?

        Thanks for the reply, BobRay!

        The page id entered on line 50 is correct
        And page id=4 is an existing page on the site (with just html content) - as I said, totally unrelated to the contact form pages.

        The spfresponse page contains only the following code:
        <code>[!SPFResponse!]</code>

          • 3749
          • 24,544 Posts
          Quote from: crosshairs at Jul 09, 2008, 11:19 PM

          On line 50 of spfconfig.cfg.php you need to put the document number of your spfResponse ("Thank-you") page. Maybe you have 4 entered there and there’s no document with that ID number?


          The doc id on line 50 is correct,

          And page with id=4 is an existing page on the site , but unrelated to the form at all. The page id=4 displays as normal after submitting, just with the URL I mentioned above - but I have no idea why it’s directing to id=4


          Look in the MODx Manager at the Tools | Configuration | Site tab

          And see what id numbers are listed for Site Start, Error Page, and Unauthorized Page. If one of them is 4, it may give us a clue.

          Bob
            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
            • 3749
            • 24,544 Posts
            Quote from: wjc38 at Jul 09, 2008, 06:31 PM

            What a great tutorial and great form. Since your asking for feedback and since I am very much a newbie at this, I figured I might as well. At this moment your request for feedback is the reason I finally registered with Modx. Here goes:

            Your tutorial stops just when it starts to get good.

            Thanks for letting me know! The tutorial somehow got truncated at that point and the rest of it didn’t make it to the production site.

            Take a look and see if it looks a little better. wink

            Bob
              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
              • 6018
              • 4 Posts
              Look in the MODx Manager at the Tools | Configuration | Site tab

              And see what id numbers are listed for Site Start, Error Page, and Unauthorized Page. If one of them is 4, it may give us a clue.

              Hmm, thanks but it’s not that either. (although it reminded me to make an Unauthorised access page wink ) I’ll take another close look and see if I come up with anything.

              What does err=1 refer to?
                • 3749
                • 24,544 Posts
                Quote from: crosshairs at Jul 10, 2008, 10:46 AM

                Look in the MODx Manager at the Tools | Configuration | Site tab

                And see what id numbers are listed for Site Start, Error Page, and Unauthorized Page. If one of them is 4, it may give us a clue.

                Hmm, thanks but it’s not that either. (although it reminded me to make an Unauthorised access page wink ) I’ll take another close look and see if I come up with anything.

                What does err=1 refer to?

                I’ve seen err=1 and it’s obviously an error message but I’m not sure where it’s genererated or what range of errors it signifies. I hope someone else does because I’ve always been curious.

                I have one more diagnostic idea. At the very end of spformproc.inc.php, change this code:

                if ($spfDebug) {
                    echo "ResponseURL: ".$responseURL.'<br>';
                }
                $modx->sendRedirect($responseURL,1);


                To this (commenting out three lines and adding the return ):

                //if ($spfDebug) {
                    echo "ResponseURL: ".$responseURL.'<br>';
                   return;
                //}
                //$modx->sendRedirect($responseURL,1);


                It should tell us where SPForm is trying to send you.

                Bob
                  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
                  • 6018
                  • 4 Posts
                  I have one more diagnostic idea. At the very end of spformproc.inc.php, change this code:

                  Code:

                  if ($spfDebug) {
                  echo "ResponseURL: ".$responseURL.’
                  ’;
                  }
                  $modx->sendRedirect($responseURL,1);


                  To this (commenting out three lines and adding the return ):

                  Code:

                  //if ($spfDebug) {
                  echo "ResponseURL: ".$responseURL.’
                  ’;
                  return;
                  //}
                  //$modx->sendRedirect($responseURL,1);


                  It should tell us where SPForm is trying to send you.

                  Hi, Bob, thanks. I tried that, and after submitting, I’m now redirected to the spformproc page, which in my case has URL:
                  http://mysite.org/index.php?id=4018

                  on this page, the following text now appears:

                  ResponseURL: http://mysite.org/index.php?id=4

                  The spformresponse page has id=4019

                  (don’t ask -- I started numbering new dev pages in my members area from 4000...
                  could it be it is only reading the first digit of the id or something??)

                  I did a search on err=1 and didn’t find anything useful.

                  Thanks for your help.
                    • 3749
                    • 24,544 Posts
                    Quote from: crosshairs at Jul 11, 2008, 10:48 AM


                    Hi, Bob, thanks. I tried that, and after submitting, I’m now redirected to the spformproc page, which in my case has URL:
                    http://mysite.org/index.php?id=4018

                    on this page, the following text now appears:

                    ResponseURL: http://mysite.org/index.php?id=4

                    The spformresponse page has id=4019

                    (don’t ask -- I started numbering new dev pages in my members area from 4000...
                    could it be it is only reading the first digit of the id or something??)


                    Actually, you’re not "redirected" to the spformproc page, you’re already there. That’s the page that contains the jump to the reponse page (which we commented out).

                    Your statement that you "started numbering your pages" has me wondering. MODx automatically generates the document ID numbers when you create the pages. They appear in parentheses next to the document name in the document tree at the left of the MODx manager. Did you actually create more then 4,000 documents or did you edit the document IDs in the database?

                    But, back to the problem.

                    It appears that you’ve uncovered a bug in SPForm that occurs when orig_referer is blank in the _POST.

                    Try replacing the last section of code in spformproc.inc.php with 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);


                    Let me know if that fixed things.

                      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
                      • 3749
                      • 24,544 Posts
                      @CROSSHAIR
                      PS: I think that for a visitor to your site, the form would have worked fine in its original form. Coming to the page directly from a link on the site would normally fill in HTTP_REFERER which makes the code work. I’m guessing you either typed in the address of the SPForm page, clicked on a favorite list, used your browser’s MRU list, or something similar which can leave it blank.

                      Bob
                        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