We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 46145
    • 4 Posts
    Hi, i'm using extra Login a i need to have more login forms on the same page.

    I found snippet property "toPlaceholder" but when I use it, the login form is not displayed.

    http://rtfm.modx.com/extras/revo/login/login.login
    http://forums.modx.com/thread/74541/two-revo-login-forms-on-the-same-page---possible

    My code:

    1. snippet call:
    [[!Login? &tplType=`modChunk` &loginTpl=`myLoginChunk` &toPlaceholder=`drivers` &loginResourceId=`37`]]


    2. myLoginChunk
    <form class="LoginForm form-horizontal" action="[[~[[*id]]]]" method="post">
        <fieldset class="LoginFieldset">
            <legend class="loginLegend">Riders</legend>
    
            <span class="description">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor.</span>
    
            <div class="loginMessage">[[+drivers.errors]]</div>
    
    		<div class="control-group">
    			<label class="control-label loginUsernameLabel" for="inputEmail">[[%drivers.username]]</label>
    			<div class="controls">
    			  <div class="input-prepend">
    				<span class="add-on"><i class="fa fa-male fa-fw"></i> </span>
    				<input class="input-medium loginUsername" type="text" name="username" id="username" placeholder="[[%drivers.username]]">
    			  </div>
    			</div>									
    		</div>	      
    
    		<div class="control-group">
    			<label class="control-label loginPasswordLabel" for="inputPassword">[[%drivers.password]]</label>
    			<div class="controls">
    			  <div class="input-prepend">
    				<span class="add-on"><i class="fa fa-key fa-fw"></i> </span>
    				<input class="input-medium loginPassword" type="password" id="password" name="password" placeholder="[[%drivers.password]]">
    			  </div>
    			</div>
    		</div>	
    
            <input class="returnUrl" type="hidden" name="returnUrl" value="[[+drivers.request_uri]]" />
    
            [[+drivers.recaptcha_html]]
            
            <input class="LoginValue" type="hidden" name="service" value="login" />
    
    		<div class="control-group control-group-last">
    			<div class="text-center LoginButton">
    			  <button type="submit" class="button" name="Login" id="Login" value="[[+drivers.actionMsg]]"><i class="fa fa-sign-in fa-1x"></i> Login</button>
    			  <a href="[[~39]]" class="button"><i class="fa fa-sign-in fa-1x"></i> Register</a>
    			</div>
    		</div>
        </fieldset>		
    </form>


    What am I doing wrong?
    How do I implement two login forms one same page?

    Thanks! [ed. note: yacobcz last edited this post 10 years, 4 months ago.]
    • Are you putting the [[+drivers]] placeholder tag on your page where you are making the login call?

      toPlaceholders typically means that the form will be loaded into the placeholder tag instead of the position of the snippet call.

      If there is no matching placeholder tag on the resultant page, modx doesn't know what to do with the result of the login snippet call.

        • 46145
        • 4 Posts
        Ok, you're right, I missed a placeholder on page - now is the login form displayed.

        But it still does not work as needed.
        When i use the second Login form, perform the redirect to a page that is specified by the "loginResourceId" parameter by the first (Login) snippet call.
        I think, that both forms work just as the first set of them.

        So parameter toPlaceholder is not what I looking for?

        I miss by Login plugin parameter "submitVar", which can i specify relevant submit button name (first snippet call = Button1, second snippet call = Button2).

        Thanks for reply!

        (apologize for my basic English, I'm learning smiley)
        • I think you are on the right track with the unique submit buttons so each snippet call is listening for the proper $_POST item.

          I haven't had a need to do two different log in forms on a page (though i can see why a page would need two).

          To clean up your code on your page, you may want to look into using Property sets http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/properties-and-property-sets which will make your snippet tags a lot cleaner, as well as allow you to use the form property sets easily in other templates if needed.

            • 46145
            • 4 Posts
            Thanks for the reply, but I still have not found a solution.

            I think I'll have to modify the snippet Login to add the support for "submitVar", which is implemented in the snippet Login.Register.
            And that will not be easy:(