We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 44891
    • 35 Posts
    Sorry, that didn't did the trick either.

    OK, from scratch

    Base Template code
    <html>
      <head>
        <title>[[*pagetitle]]|[[++site_name]]</title>
        <base href="[[++site_url]]" />
      </head>
        <body>
          [[*content]]
        </body>
    </html>


    index.php?id=5 page code
    <p>Enter a name</p>
    [[!GetArtist?&landing='5']]
    


    Snippet code with the name GetArtist
    $docId = $modx->getOption('landing',$scriptProperties,$modx->resource->get('id'));
    $url = $modx->makeUrl($docId, "", "", "full");
     
    return $output =  '<form name="form" action="' . $url . '" method="get"><input type="text" value="Rembrandt" name="q" />
    <input type="submit" name="Submit" value="Search" /></form>';
    


    When I use the Base Template it is strange that the part
    <p>Enter a name</p>
    from the index.php?id=5 page isn't displayed.

    I'm a little bit desperate I can't tackel this one. My php, html or jscript skills are above mediocre so that is not the problem. I understand what I'm doing but at the moment I'm in a dead end.

    Perhaps somebody can give me a link to a working form in Modx with just plain html without things like Chuncks, Snippets, PHP etc so I can take that as a starting point.
      • 4172
      • 5,888 Posts
      If you are still talking about this page:
      www.bertverberne.com/modx/index.php?id=5

      there seems to be used the 'blank' - template.
      Not your base template
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 44891
        • 35 Posts
        If you are still talking about this page:
        www.bertverberne.com/modx/index.php?id=5

        Yes, correct. But I think it isn't template related. When I pick another template like (empty), that doesn't change things.
        I use this very basic code for a BaseTemplate

        <html>
          <head>
            <title>[[*pagetitle]]|[[++site_name]]</title>
            <base href="[[++site_url]]" />
          </head>
            <body>
              [[*content]]
            </body>
        </html>


        However, I noticed something weird. When I surf directly to
        http://www.bertverberne.com/modx/index.php?id=5
        I don't see the pagetitle and the sitename in the tab.


        But when I press a letter I get the names I want and the pagetitle and the sitename in the tab
          • 3749
          • 24,544 Posts
          I've had weird effects happen because the BaseTemplate has no DOCTYPE. I doubt if that's your problem, but it's worth a try.
            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
            • 44891
            • 35 Posts
            Quote from: BobRay at Nov 25, 2013, 06:11 PM
            I've had weird effects happen because the BaseTemplate has no DOCTYPE. I doubt if that's your problem, but it's worth a try.

            Thanks Bob, tried that didn't work but I fiddled around further. So, the problem was an incorrect redirect. The code kicked me most of the time back to the root page with the name index.php?id=1. What I did was taking the code from page 5, which was nothing more then a call to the snippet
            [[!GetArtist?&landing='1']]
            and put it on page 1. Of course I changed the Landing parameter to 1
            Et Voila!, It worked. Not flawlessly but the basic idea is working. I don't no why this isn't working on a different page but at the moment this is the least of my concerns.
            Thanks everybody by staying with me. Your input was valuable because it pushed me to search further.
              • 4172
              • 5,888 Posts
              Use backtics in snippet-tag-properties!

              [[!GetArtist?&landing=`1`]]


              not

              [[!GetArtist?&landing='1']]
                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
                • 44891
                • 35 Posts
                OK, with the risk of being boring.
                Summarizing. So the problem is that the redirect in the form action part kicks me always back to the homepage. No matter on what page I put the content. I stripped everything down to the bone for clarity. That makes it easier to fiddle around for everybody who wants to tackle this one.

                Template code:

                <html>
                <head>
                <title>[[++site_name]] - [[*pagetitle]]</title>
                <base href="[[++site_url]]" />
                </head>
                <body>
                [[*content]]
                </body>
                </html>


                Snippet code:

                <?php
                $docId = $modx->getOption('landing',$scriptProperties,$modx->resource->get('id'));
                $url = $modx->makeUrl($docId, "", "", "full");
                
                echo '<form name="form" action="' . $url . '" method="get">';
                echo 'Name: <input type="text" name="name" value="John Doe"><br>';
                echo 'E-mail: <input type="text" name="email" value="[email protected]"><br>';
                echo '<input type="submit">';
                echo '</form>';
                echo $_GET["name"];
                echo '<br />';
                echo $_GET["email"];
                ?>


                Content:
                [[!test_snippet]]


                The goal is to land on the page where ever the [[!test_snippet]] code is put and display the information (NOT on the homepage). [ed. note: strooman last edited this post 12 years, 10 months ago.]
                  • 4172
                  • 5,888 Posts
                  there must be something wrong with any of your configurations.

                  This is just working:

                  http://courtreservation.webcmsolutions.modxcloud.com/test-snippet.html
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                    • 28042 ☆ A M B ☆
                    • 24,524 Posts
                    If you used the fastField add-on you wouldn't need a snippet at all.
                    <form name="form" action="[[~[[#get.landing]]]]" method="get">
                    Name: <input type="text" name="name" value="John Doe"><br>
                    E-mail: <input type="text" name="email" value="[email protected]"><br>
                    <input type="submit">
                    </form>
                    [[#get.name]]<br>
                    [[#get.email]]
                    

                    http://rtfm.modx.com/extras/revo/fastfield
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 44891
                      • 35 Posts
                      Quote from: Bruno17 at Nov 28, 2013, 06:56 AM
                      there must be something wrong with any of your configurations.

                      This is just working:

                      http://courtreservation.webcmsolutions.modxcloud.com/test-snippet.html

                      Nothing wrong with my configuration. I even did a clean install. Your example works because you use a plain html page. My problem is that this works when you create this example on a regular html page outside Modx (like you did) or if you create this example in a php page but NOT within Modx. We are talking about a very basic form procedure. It looks very strange to me that one has to use an complete add-on to make this work.
                      When I am wrong please give me a working example without the use of add-ons or other complicated stuf. [ed. note: strooman last edited this post 12 years, 10 months ago.]