We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37054
    • 93 Posts
    Hey folks,

    Been looking at this for hours ow and with no success. I want to register users via the front end. My Register snippet call is:

    [
    ]
    [[!Register? &activation=`0` &submittedResourceId=`65` &usernameField=`email` &emailField=`email`]][[$hsRegisterForm]]
    [
    ]

    and my form chunk looks like:

    [
    ]
    <div class="register">
        <div class="registerMessage">[[+error.message]]</div>
        <form name="reg_form" id="reg_form" class="form" action="[[~[[*id]]]]" method="post">
            <input type="hidden" name="nospam:blank" value="" />
    <h2>Login Info</h2>
            <div class="col2">
            	<label for="email">Your Email</label>
            </div>    
            <div class="col6 last">
            	<input type="text" name="email:required:required:minLength=6" id="email" value="[[+email]]" />
    <label>*</label>
            	<span class="error">[[+error.email]]</span>
            </div>
            <div class="clear"></div>
            <div class="col2">
            	<label for="password">Password</label>
            </div>
            <div class="col6 last">
                <input type="password" name="password:required:minLength=6" id="password" value="[[+password]]" />
    <label>*</label>
    <span class="smlltxt">(Must be 6 characters or longer)</span>
            	<span class="error">[[+error.password]]</span>
            </div>
            <div class="clear"></div>
            <div class="col2">
            	<label for="password_confirm">Confirm Password</label>
            </div>
            <div class="col6 last">
            	<input type="password" name="password_confirm:password_confirm=`password`" id="password_confirm" value="[[+password_confirm]]" />
    <label>*</label>
           	 	<span class="error">[[+error.password_confirm]]</span>
            </div>
            <div class="clear"></div>
    <h2>Contact Info</h2>
            <div class="col2">
            	<label for="fullname">Your Full Name</label>
            </div>
            <div class="col6 last">
            	<input type="text" name="fullname:required" id="fullname" value="[[+fullname]]" />
    <label>*</label>
            	<span class="error">[[+error.fullname]]</span>
            </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="mobilephone">Mobile Number</label>
            </div>
            <div class="col6 last">
            	<input type="text" name="mobilephone:required" id="mobilephone" value="[[+mobilephone]]" />
    <label>*</label>
            	<span class="error">[[+error.mobilephone]]</span>
            </div>
           <div class="clear"></div>
    <h2>Billing Info</h2>
    <div class="col2">
            	<label for="address">Billing Address</label>
            </div>
            <div class="col6 last">
            	<textarea name="address:required" id="address" rows="2">[[+address]]</textarea>
    <label>*</label>
            	<span class="error">[[+error.address]]</span>
            </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="city">City</label>
            </div>
            <div class="col6 last">
             	<input type="text" name="city" id="city" value="[[+city]]" />
           </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="zip">Postal Code</label>
            </div>
            <div class="col6 last">
             	<input type="text" name="zip" id="zip" value="[[+zip]]" />
           </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="state">County/Region</label>
            </div>
            <div class="col6 last">
             	<input type="text" name="state:required" id="state" value="[[+state]]" />
    <label>*</label>
            	<span class="error">[[+error.state]]</span>
           </div>
           <div class="clear"></div>
    <div class="col2">
    <label for="country">Country</label>
    </div>
    <div class="col6 last">
    <select name="country" id="country" title="Please indicate your country of residence">
    <option value="Ireland"[[+country:ifequalto=`Ireland`:then=` selected="selected"`]]>Ireland</option>
    <option value="United Kingdom"[[+country:ifequalto=`United Kingdom`:then=` selected="selected"`]]>United Kingdom</option>
    </select>
    <label>*</label>
    </div>
    <div class="clear"></div>
    <h2>Delivery Info</h2>
    <p>
    <label for="chk_ship">My delivery info is the same as my billing info</label> 
    <input type="checkbox" id="chk_ship" value="The Same"/>
    </p>
    <div class="clear"></div>
    <div class="col2">
            	<label for="ship_fullname">Name</label>
            </div>
            <div class="col6 last">
            	<input type="text" name="ship_fullname:required" id="ship_fullname" value="[[+ship_fullname]]"/>
    <label>*</label>
            	<span class="error">[[+error.ship_fullname]]</span>
            </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="ship_address">Address</label>
            </div>
            <div class="col6 last">
            	<textarea name="ship_address:required" id="ship_address" rows="2">[[+ship_address]]</textarea>
    <label>*</label>
            	<span class="error">[[+error.ship_address]]</span>
            </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="ship_city">City</label>
            </div>
            <div class="col6 last">
             	<input type="text" name="ship_city" id="ship_city" value="[[+ship_city]]" />
           </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="ship_zip">Postal Code</label>
            </div>
            <div class="col6 last">
             	<input type="text" name="ship_zip" id="ship_zip" value="[[+ship_zip]]" />
           </div>
           <div class="clear"></div>
    <div class="col2">
            	<label for="ship_state">County/Region</label>
            </div>
            <div class="col6 last">
             	<input type="text" name="ship_state:required" id="ship_state" value="[[+ship_state]]" />
    <label>*</label>
            	<span class="error">[[+error.ship_state]]</span>
           </div>
           <div class="clear"></div>
    <div class="col2">
    <label for="ship_country">Country</label>
    </div>
    <div class="col6 last">
    <select name="ship_country" id="ship_country" title="Please indicate the address you wish to have your current order shipped to">
    <option value="Ireland"[[+ship_country:ifequalto=`Ireland`:then=` selected="selected"`]]>Ireland</option>
    <option value="United Kingdom"[[+ship_country:ifequalto=`United Kingdom`:then=` selected="selected"`]]>United Kingdom</option>
    </select>
    <label>*</label>
    </div>
    <div class="clear"></div>
            <div class="form-buttons">
                <input type="submit" name="login-register-btn" value="Register" />
            </div>
        </form>
    </div>
    [
    ]

    Form submits fine, even validates but the user is not registered. Can anyone spot what I am missing because I can't.
      • 37054
      • 93 Posts
      The last square bracket isn't in the chunk - don't know where it came from...
        • 37054
        • 93 Posts
        I should also add that this doesn't work with the standard form shipped with Login - whatever is the problem it doesn't seem to be the chunk
          • 28215
          • 4,149 Posts
          Try calling your form chunk uncached:

          [[!$hsRegisterForm]]
          
            shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
            • 37054
            • 93 Posts
            No difference I'm afraid - this is a strange one. How would you suggest I go about debugging?
              • 37054
              • 93 Posts
              This gets even stranger - I added a preHook snippet and a postHook snippet and both are executed successfully. However, only the preHook seems to have access to the $hook object as $hook->getValue returns nothing in the postHook snippet, either for username, email or password.
                • 37054
                • 93 Posts
                Nothing in the Apache error log, nothing in the ModX error log sad
                  • 37054
                  • 93 Posts
                  Still had no luck with 1.7 so I installed Login on another site I have here and the same result. Got the 1.65 package from another site I have, installed that and it works fine so there is definitely a problem with 1.7. Note, just to be clear, my issue was with a fresh install of 1.7 - not an upgrade of a previous version.

                  Anyway, if you're having problems with 1.7, just downgrade you Login package to 1.65 for now
                    • 28215
                    • 4,149 Posts
                    This should be solved now in 1.7.0-rc2. Thanks for catching it!

                    P.S. There's now a unit test for your form: https://github.com/splittingred/Login/blob/develop/core/components/login/test/Tests/Cases/Register/RegisterFormOneTest.php
                      shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                      • 37054
                      • 93 Posts
                      It wasn't a voluntary effort laugh Thanks for sorting it smiley