We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    fourroses666 Reply #1, 13 years ago
    On my website on every page I have a Login form.
    When I visit a page the form is not visible, after reloading the page the form gets visible.
    After that the form keeps being visible.
    When I clear cache again the first time I visit that page again its not visible anymore.

    My call:
    [!WebLogin?
    &loginhomeid=`6`
    &logouthomeid=`1`
    &tpl=`weblogin`
    !]


    I can not use;
    [[WebLogin? ... ]]


    Evo 1.0.12
    WebLogin 1.1
    All pages cachable checked
      Evolution user, I like the back-end speed and simplicity smiley
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      You can never have a cached snippet for dynamic content, such as for a form. The page is cached, the snippet's output is cached, the snippet tags are removed. The next time the page is served from cache, there are no snippet tags to process any POST values. So such snippets always have to be uncached so the snippet tags are not removed. Unless, of course, the page itself is uncached.

      As to why it's not working on initial page load, I have no idea.
        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
        • 9995
        • 1,613 Posts
        fourroses666 Reply #3, 13 years ago
        Ok thanks, uncached is the way to do it then.

        Did some testing on the multilanguage website (YAMS).
        I have a NL and EN weblogin form which seemed to be the problem.
        When I remove one of them all is back to normal, directly the loginform is visible.

        Duplicate the snippet doesn't work sad
        Gona try webloginPE
        [ed. note: fourroses666 last edited this post 13 years ago.]
          Evolution user, I like the back-end speed and simplicity smiley
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          Ah. YAMS is another matter. I have a site using YAMS with login, but I'm using an AJAX-based login.

          Here is the login chunk:
          <div id="loginBlock">
          <a class="button" id="loginLink" href="[~47~]" onclick="return loadlogin()">[!YAMS? &get=`text` &from=`de::Kunden-Login||en::Client login||fr::Login client||it::Login cliente`!]</a>
          <div id="loginDiv"></div>
          <script>
          function loadlogin() {
              $("#loginDiv").load("[~47~]");
              return false;
          }
          function login(f) {
              var username = f.username.value;
              var password = f.password.value;
              $("#loginDiv").load("[~47~]", {'username': username, 'password': password, 'cmdweblogin': 'login'});
              return false;
          }
          function logout() {
           $.ajax({
             url: "[~47~]",
             data: "webloginmode=lo",
             success: function(msg){
                window.location.replace("[(site_start)]");
             }
           });
              return false;
          }
          </script>
          </div>

          And here is all that there is in the resource #47 (no template)
          [[Login? &loginhomeid=`48` &logouthomeid=`1` &tpl=`loginTpl`]]
          

          And the loginTpl chunk:
              <!-- #declare:separator <hr> --> 
              <!-- login form section-->
              <form method="post" name="loginfrm" action="[~[*id*]~]" onsubmit="return login(this)"> 
              <input type="hidden" value="" name="rememberme"> 
              <input type="text" name="username" tabindex="1" size="8" style="width: 150px;" value="[+username+]">
              <input type="password" name="password" tabindex="2" style="width: 150px;" value="" />                                   
              <input type="submit" value="[+logintext+]" name="cmdweblogin"></form>
          <hr>
          <!-- log out hyperlink section -->
          <a href='[+action+]'>[+logouttext+]</a>
            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
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            The thing is, you can use the [!Yams...!] snippet to generate the prompts and anything else you need in the tpl for each language. Thus you use the same login snippet, just give it dynamic text where you need it.
              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
              • 9995
              • 1,613 Posts
              fourroses666 Reply #6, 13 years ago
              thanks for your example.
              didn't try to add yams get=`text` and will do that!

              webloginPE seems to work thow.
                Evolution user, I like the back-end speed and simplicity smiley
                • 9995
                • 1,613 Posts
                fourroses666 Reply #7, 13 years ago
                I have tested your example. That one didn't work for me.
                I needed the form to show on every page.

                I had a fix for that, body onload worked but other problems came along.
                Right now I have used webloginPE and this seem to work for the login part.
                [ed. note: fourroses666 last edited this post 13 years ago.]
                  Evolution user, I like the back-end speed and simplicity smiley