We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36924 ☆ A M B ☆
    • 298 Posts
    what does this line achieve:
    <span id="sbs_js_lexicon" style="display:none">[[+sbs_lexicon_json]]</span>
      • 36924 ☆ A M B ☆
      • 298 Posts
      I put back the onClick event, still get no errors and it does not submit. I'm trying to customize it to conform to the Login snippet register form I had previously, here is my subscribe call:

      [[!SubscribeForm?
          &form=`register`
      ]]
      [[!Register?
          &form=`register`
          &submitVar=`login-register-btn`
          &activationResourceId=`[[++sbs_confirm_register_page_id]]`
          &submittedResourceId=`[[++sbs_thank_you_page_id]]`
          &postHooks=`SubscribeForm`
          &activationttl=`480`
          &useExtended=`1`
          &usergroups=`Subscribers:Subscriber,Registered Vendors:Member`
          &activationEmailTpl=`sbsActivationEmailTpl`
          &activationEmailSubject=`Please activate your account at [[++site_name]]!`
          &validate=`nospam:blank,
               username:required:minLength=^6^,
               password:required:minLength=^6^,
               password_confirm:password_confirm=^password^,
               email:required:email`
          &placeholderPrefix=`reg.`
      &preHooks=`RegistrationTimeTpl`
      &postHooks=`VendorRegistrationAlert`
      ]]
      
      
      <div class="register">
      
      <div class="registerMessage">[[+error.message]]</div>
      
      <form action="[[~[[*id]]]]" method="post" id="message" class="section sbs_register_form" onsubmit="return checkform(this); return false;">
      <input type="hidden" name="nospam:blank" value="" />            
      						<ul>
      						  <li>
      								<label>Company Name: <p class="error">[[+error.companyname]]</p></label>
      								<input type="text"  name="companyname:required" id="companyname" value="[[+companyname]]">
                                      
      							</li>
      							<li>
      								<label>Company Address: <p class="error">[[+error.companyaddress]]</p></label>
      								<input type="text"  name="companyaddress:required" id="companyaddress" value="[[+companyaddress]]">
                                      
      							</li>
                                  <li>
      							  <label>Company Website: <p class="error">[[+error.website]]</p></label>
      							  <input type="text"  name="website:required" id="website" value="[[+website]]">
                                    
      			        </li>
      <fieldset id="contact-person">
      <legend>Contact Person</legend>
      						<li>
      							  <label>Designation: <p class="error">[[+error.position]]</p></label>
      							  <input type="text" name="position:required" id="position" value="[[+position]]">
      					    </li><li>
      								<label>Full Name:<p class="error">[[+error.fullname]]</p></label>
      								<input type="text"  name="fullname:required" id="fullname" value="[[+fullname]]">
                                      
      							</li>
                                  <li></li>
                                  
                                   <li>
      								<label>Phone Number: <p class="error">[[+error.phonenumber]]</p></label>
      								<input type="text"  name="phonenumber:required" id="phonenumber" value="[[+phonenumber]]">
                                  </li>
                                  <li>
      							  <label>Email Address:<p class="error">[[+error.email]]</p></label>
      								<input type="text" name="email:email" id="email" value="[[+email]]">
                                      
      							</li>
      							 
                                  <fieldset id="cpg-account">
      <legend>CPG Account</legend>
                                <li>
      								<label>Username: <p class="error">[[+error.username]]</p></label>
      								<input type="text" name="username:required:minLength=6" id="username" value="[[+username]]">
                                      
      							</li>
                                  <li>
      								<label>Password: <p class="error">[[+error.password]]</p>
      </label>
      								<input type="text" name="password:required:minLength=6" id="password" value="[[+password]]">
                                      
      							</li>	
                                  <li>
      								<label>Confirm Password: <p class="error">[[+error.password_confirm]]</p>
      </label>
      								<input type="text" name="password_confirm:password_confirm=`password`" id="password_confirm">
                                      
      							</li>
                                   </fieldset>						
                               </fieldset>
                                 <li>
                                  <label></label>
                                      <input type="reset" value="Reset">
                                      <input type="submit" name="login-register-btn" id="login-register-btn" value="[[!%sbs_submit_button_text]]">
      							</li>                           
                                 
      						</ul>
      		  </form>
      </div>
      I'
        • 36924 ☆ A M B ☆
        • 298 Posts
        Ok. Something most have been omitted. I took the default sbsRegisterFormTpl chunk, added the extended fields I require along with my PreHook and Posthook; and also changed all the instance of !+reg to + (as the form values where not been returned with !+reg) to now be able to get the error alert box but it still doesn't submit. Here is my current call:

        [[!SubscribeForm?
            &form=`register`
        ]]
        [[!Register?
            &form=`register`
            &submitVar=`login-register-btn`
            &activationResourceId=`[[++sbs_confirm_register_page_id]]`
            &submittedResourceId=`[[++sbs_thank_you_page_id]]`
            &postHooks=`SubscribeForm`
            &activationttl=`480`
            &usergroups=`Subscribers:Subscriber,Registered Vendors:Member`
            &activationEmailTpl=`sbsActivationEmailTpl`
            &activationEmailSubject=`Please activate your account at [[++site_name]]!`
            &validate=`nospam:blank,
                 username:required:minLength=^6^,
                 password:required:minLength=^6^,
                 password_confirm:password_confirm=^password^,
                 email:required:email,
                 companyname:required,
                 companyaddress:required,
                 website:required,
                 phonenumber:required`
            &preHooks=`RegistrationTimeTpl`
            &postHooks=`VendorRegistrationAlert`
        ]]
        
        <div class="register">
            <div class="registerMessage">[[+error.message]]</div>
        
            <form id="message" class="sbs_register_form section" action="[[~[[*id]]]]" method="post" onsubmit="return checkform(this); return false;">
                    <input type="hidden" name="nospam" value="[[+nospam]]" />
            <ul>
        						  <li>
        								<label>Company Name: <p class="error">[[+error.companyname]]</p></label>
        								<input type="text"  name="companyname" id="companyname" value="[[+companyname]]">
                                        
        							</li>
        							<li>
        								<label>Company Address: <p class="error">[[+error.companyaddress]]</p></label>
        								<input type="text"  name="companyaddress" id="companyaddress" value="[[+companyaddress]]">
                                        
        							</li>
                                    <li>
        							  <label>Company Website: <p class="error">[[+error.website]]</p></label>
        							  <input type="text"  name="website" id="website" value="[[+website]]">
                                      
        			        </li>
        <fieldset id="contact-person">
        <legend>Contact Person</legend>
        						<li>
        							  <label>Designation: <p class="error">[[+error.position]]</p></label>
        							  <input type="text" name="position:required" id="position" value="[[+position]]">
        					    </li><li>
        								<label>Full Name:<p class="error">[[+error.fullname]]</p></label>
        								<input type="text"  name="fullname:required" id="fullname" value="[[+fullname]]">
                                        
        
        </li>
                                    
                                     <li>
        								<label>Phone Number: <p class="error">[[+error.phonenumber]]</p></label>
        								<input type="text"  name="phonenumber" id="phonenumber" value="[[+phonenumber]]">
                                    </li>
                                    <li>
        							  <label for="email">Email Address:<p class="error">[[+error.email]]</p></label>
        								<input type="text" name="email" id="email" value="[[+email]]">
        
        							</li>
                <fieldset id="cpg-account">
        
                
                <legend>CPG Account</legend>
                                  <li>
        								<label for="username">[[!%register.username? &namespace=`login` &topic=`register`]]: <p class="error">[[+error.username]]</p></label>
        								<input type="text" name="username" id="username" value="[[+username]]">
                                        
        							</li>
                                    <li>
        								<label>Password: <p class="error">[[+error.password]]</p>
        </label>
        								<input type="text" name="password" id="password" value="[[+password]]">
                                        
        							</li>	
                                    <li>
        								<label>Confirm Password: <p class="error">[[+error.password_confirm]]</p>
        </label>
        								<input type="text" name="password_confirm" id="password_confirm" value="[[+password_confirm]]">
                                        
        							</li>
        
                
                    <br class="clear"/>
        
                [[+register.recaptcha_html]]
                [[+error.recaptcha]]
                <br />
        <li>
                                    <label></label>
                                        <input type="reset" value="Reset">
        
                    <input type="submit" name="login-register-btn" value="[[!%sbs_submit_button_text]]" />
        
        </li>
            	</fieldset>
            </fieldset>
            </form>
            <span id="sbs_js_lexicon" style="display:none">[[+sbs_lexicon_json]]</span>
        </div>
          • 3749
          • 24,544 Posts
          Quote from: ojchris at Aug 06, 2013, 03:34 AM
          what does this line achieve:
          <span id="sbs_js_lexicon" style="display:none">[[+sbs_lexicon_json]]</span>

          That's used to insert the lexicon strings used in the JS error alerts.
            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
            • 36924 ☆ A M B ☆
            • 298 Posts
            Ok. The form still doesn't submit, only reloads (even when the submit button is rightly named. I have a reset button as well could that be the problem?

            Also I created a new mysubscribe.js and inseted this:

            if (form.companyname.value == "") {
            alert(lexArray.sbs_js_companyname_required);
            form.companyname.focus();
            return false;
            }

            when empty I get the arlet box stating undefined Where do I state define it ( as part of this array: lexArray.sbs_js)?
              • 36924 ☆ A M B ☆
              • 298 Posts
              I just realized lexicon is only mentioned on the System tab of the manager. So I made a new entry under subscribe, cleared cache and now get the appropriate alert message.

              But still cannot submit
                • 3749
                • 24,544 Posts
                Try looking in Chrome Dev. tools or Firebug to see if it shows any JS errors.
                  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
                  • 36924 ☆ A M B ☆
                  • 298 Posts
                  Sorry to bother you so. I think tweaking made me understand the structure of MODx and the snippet thingy more.

                  I used FireBug has adviced and saw nothing so I had to try other possibilities.

                  Here is what I found: I had a spelling error in both PreHook and PostHook of the Register call. Instead of &preHooks=`RegistrationTimeTpl` I should have &preHooks=`getVendorRegistrationTime` and rather than &postHooks=`VendorRegistrationAlert`, it should have been &postHooks=`VedorRegistrationAlert`. Basically there were typos in both snippet naming.

                  I inserted both properties into the default register chunk of subscribe and it failed to submit but when I took both off the registration went on successfully. So I repeated this debugging the process for the custom register chunk and voila!

                  I think I was too in a hurry. Not a good attitude for this geek things of ours.

                  Please me again. But I guess you gained and insight into some possible future enhancement. One of which is Subscribe without JS.

                  On a cursory consideration, how will a Subscribe without JS (esp. were JS is turned off) be implemented?

                    • 3749
                    • 24,544 Posts
                    Quote from: ojchris at Aug 07, 2013, 01:51 AM

                    On a cursory consideration, how will a Subscribe without JS (esp. were JS is turned off) be implemented?

                    I'm not sure. I'd have to spend some time looking at the code. The effect will be for the form to be re-displayed with error messages in it.

                    If you feel like playing around, you could try just inserting the proper tags for the error messages into the Tpl chunk (see the lgnRegisterForm Tpl chunk in the Login category). The Register snippet sets them and it may handle your custom fields if you use Registers's validation.
                      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
                      • 36924 ☆ A M B ☆
                      • 298 Posts
                      I'll see what I come up with and update thread asap.