We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 15001
    • 697 Posts
    I was able to determine precisely in which case the bug occurs.
    It occurs if the character encoding is "UTF-8" and if there are comments.

    My page being UTF-8 encoding, the solution was to remove all comments.
    The bug does not occur if there are comments but the ANSI charset is used.
      • 15001
      • 697 Posts
      <a href = "[~12~]&selected=Webmaster">Contact</a>
      Does this work only if the SPForm snippet code is saved in document 12 ?
      Or also if document 12 has a SPForm call + some other HTML code ?

      Secondly, howto do if a button is used to call the form ?
      <form action="[~12~]&selectedItem=Webmaster">
      <input type="submit" value="Contact us by email" />
      </form> 

      I tested above code, but it does not work.

      Thanks.
        • 3749
        • 24,544 Posts
        Quote from: Jul at Sep 30, 2009, 07:38 AM

        I was able to determine precisely in which case the bug occurs.
        It occurs if the character encoding is "UTF-8" and if there are comments.

        My page being UTF-8 encoding, the solution was to remove all comments.
        The bug does not occur if there are comments but the ANSI charset is used.

        Thanks for scoping that out. I’ll see if I can duplicate it. It’s odd because the editor I created the file with is set for UTF-8.
          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: Jul at Sep 30, 2009, 09:02 AM

          <a href = "[~12~]&selected=Webmaster">Contact</a>
          Does this work only if the SPForm snippet code is saved in document 12 ?
          Or also if document 12 has a SPForm call + some other HTML code ?

          Secondly, howto do if a button is used to call the form ?
          <form action="[~12~]&selectedItem=Webmaster">
          <input type="submit" value="Contact us by email" />
          </form> 

          I tested above code, but it does not work.

          Thanks.

          There’s no way to store snippet code in a document so the 12 would have to refer to a document containing a call to the SPForm snippet (plus other HTML code).

          For the button, if you have Friendly URLs off, try:

          <form action="[~12~]?selectedItem=Webmaster">



          With FURLS on, your version should 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
            • 28494
            • 32 Posts
            I’m quite new with MODx (and SPForm), and I’m having trouble with lexicon strings in SPForm. Specifically, I wanted to change the label text which appears on the contact form, so I changed the appropriate strings in the default.inc.php file, with no luck.

            I then thought maybe it was a caching issue, so I turned off everything related to caching that I could from system settings, cleared browser cache, but still no luck.

            Then I found the modx_lexicon_entries table and changed the value fields that I needed changed, and this worked.

            I’m assuming editing table rows directly is not the recommended way to adjust lexicon strings smiley Can anyone tell me a better way?

            Thanks.

            Edit: Forgot to mention that I’m using the latest SPForm with Revo beta3, installed using the package manager.
              • 3749
              • 24,544 Posts
              System | Lexicon Management

              Namespace: spform
              Topic: default

              smiley

              Sorry you had to do it the hard way.
                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
                • 28494
                • 32 Posts

                System | Lexicon Management

                Namespace: spform
                Topic: default

                Smiley

                Sorry you had to do it the hard way.

                Thanks, that did the trick...ahh, what would life be like without learning curves...
                  • 15001
                  • 697 Posts
                  Hi Bob, Thanks for your answers.

                  On the page telling that the email was sucessfully sent, I have some link which, when clicked, should redirect to the page where the user was. But I observe that it redirects to the first sibling in the same category or to the parent document (since it has a FirstChildRedirect).
                  In the structure below, document 11 has the spForm call.
                  If the email was sent, document 15 displays with a link to document 4.

                  --some category (2) (with a call to FirstChildRedirect)
                  |--first topic (4)
                  |--other documents
                  |--contact (11)

                  --sucessfull form processing (15)

                  Is this normal behaviour ?
                  Thanks.
                    • 3749
                    • 24,544 Posts
                    Quote from: Jul at Oct 16, 2009, 07:22 AM

                    Hi Bob, Thanks for your answers.

                    On the page telling that the email was sucessfully sent, I have some link which, when clicked, should redirect to the page where the user was. But I observe that it redirects to the first sibling in the same category or to the parent document (since it has a FirstChildRedirect).
                    In the structure below, document 11 has the spForm call.
                    If the email was sent, document 15 displays with a link to document 4.

                    --some category (2) (with a call to FirstChildRedirect)
                    |--first topic (4)
                    |--other documents
                    |--contact (11)

                    --sucessfull form processing (15)

                    Is this normal behaviour ?
                    Thanks.

                    SPForm uses this code to set the URL to return to:

                    $ref = getenv("HTTP_REFERER");
                        if (empty($ref)) {
                            $ref = $_SERVER["HTTP_REFERER"];
                        }
                     if(!empty($ref)) {
                    
                           $_SESSION['origReferer'] = $ref;
                     }


                    Unfortunately, HTTP_REFERER is set by the user agent and isn’t always accurate. That’s why SPForm has the option to turn off the "Take me back" link.

                    The only alternative I could think of was a plugin that saved the page ID for use on the "Thank You" page in a $_SESSION variable on every page access other than the contact page. I thought the performance hit was too big for that solution.

                    I’m open to other ideas.
                      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
                      • 15001
                      • 697 Posts
                      Thanks. That’s interesting.

                      Maybe a simple approach could be updating a chunk storing the "Submit from" document id when the form is posted and read that chunk from the "Thank you" page.

                      I did not check, but I think it should be possible with MODx’s API.
                      Not very important for me; just an idea for future versions.