We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25308
    • 46 Posts
    Modx version: Revolution 2.07
    Me: still pretty new to Modx

    Greetings all,
    I’ve been reading through the forums and documentation and I have a quick question about the registration snippet in the login package. In my registration form I would like to collect the following info:

    •Full name
    •Password
    •Business
    •Phone#
    •Alternate Phone#
    •Address
    •Email address
    •Would you like to receive promotional emails?
    •A blank (to squash spam bots)

    I would also like to assign them to a user group called "customers"

    The Login.Register documentation says "Register is a registration form processing Snippet" and then it has a link an example. I’m assuming by the description that I can make a custom form and it will process it given that it has the processing code at the beginning:
    [[!Register?
        &submitVar=`registerbtn`
        &activationResourceId=`12`
        &activationEmailTpl=`myActivationEmailTpl`
        &activationEmailSubject=`Thanks for Registering!`
        &submittedResourceId=`45`
        &usergroups=`customers`
    ]]


    and the submit button
    <input type="submit" name="registerbtn" value="Register" />
    at the end.

    When I create a new form, can I format the labels and input fields in the same manner that the example is and be successful?

    for example:
    <label>Business:<span class="error">[[+error.business]]</span></label>
    <input type="text" name="business:required" value="[[+business]]" />

    I haven’t figured out how to handle the " would you like promotional emails" line either. Right now I’ll the most concerned with the other inputs. But if you know a method off the top of your head your advice will be great. Any help with this will be greatly appreciated. I have a tendency to over complicate things I’m just starting to understand. Thanks in advance grin

    Thanks, -RL
      • 25308
      • 46 Posts
      Ok. So I"m still moving along with this and am flying kinda blind but using the best rationale that I have in understanding this.

      I’ve reconfigured the login using the original example that they give in the documentation and adding custom fields exactly the way they have is in the documentation as well. The only thing different now is that I am still including the invisible fields in hopes that I will be able to manually alter them in my own display of the user information.

      My new questions are:
      1. am I correct in the assumptions about the invisible fields and are they formatted correctly
      2. does anyone know how to handle select fields. I’m trying to make a yes/no select field for a "would you like to receive promotional materials?" field.
      3. Do I need to create the emailtpl? or is that part of the included snipets? I didn’t see it but,...that doesn’t mean that it’s not somewhere. I couldn’t find any documentation on this. sad

      Here’s my new trial of my code:

      <h2>Register</h2>
       
      [[!Register?
          &submitVar=`registerbtn`
          &activationResourceId=`12`
          &activationEmailTpl=`myActivationEmailTpl`
          &activationEmailSubject=`Thanks for Registering!`
          &submittedResourceId=`23`
          &usergroups=`customers`
      ]]
       
      <div class="register">
          <div class="registerMessage">[[+error.message]]</div><br>
      *Required Fields
        
      <form class="form" action="[[~[[*id]]]]" method="post">
              <input type="hidden" name="nospam:blank" value="" />
              <br>
              <label for="username">*[[%register.username? &namespace=`login` &topic=`register`]]
                  <span class="error">[[+error.username]]</span>
              </label>
              <br>
              <input type="text" name="username:required:minLength=6" id="username" value="[[+username]]" />
               
      <label for="password"><br>
              *[[%register.password]]
                  <span class="error">[[+error.password]]</span>        </label>
              <br>
              <input type="password" name="password:required:minLength=6" id="password" value="[[+password]]" />
               
      <label for="password_confirm"><br>
              *[[%register.password_confirm]]
                  <span class="error">[[+error.password_confirm]]</span>        </label>
              <br>
              <input type="password" name="password_confirm:password_confirm=`password`" id="password_confirm" value="[[+password_confirm]]" />
               
              <label for="fullname"><br>
              *[[%register.fullname]]
                  <span class="error">[[+error.fullname]]</span> </label>
              <br>
              <input type="text" name="fullname:required" id="fullname" value="[[+fullname]]" />
              <br>
              <label for="email">*[[%register.email]]
                  <span class="error">[[+error.email]]</span>
              </label>
              <br>
              <input type="text" name="email:email" id="email" value="[[+email]]" />
              <br>
      		<label>*Phone#: <span class="error">[[+error.phone]]</span> <br>
      		<input type="text" name="phone:required" value="[[+phone]]" /></label>
              <br>
              <label>Alt. Phone#: <span class="error">[[+error.alt_phone]]</span> <br>
      		<input type="text" name="alt_phone" value="[[+alt_phone]]" /></label>
              <br>
              <label>Business: <span class="error">[[+error.business]]</span> <br>
      		<input type="text" name="business" value="[[+business]]" /></label>
              <br>
          <label>Would you like to receive promotions on special deals? <span class="error">[[+error.notifications]]</span> <br>
          <select name="color">
         <option value="yes" [[!+fi.color:FormItIsSelected=`yes`]] >Yes</option>
         <option value="no" [[!+fi.color:FormItIsSelected=`no`]] >No</option>
      </select></label>
      <br>
      
      <input name="address" type="hidden" value="[[+address]]" />
      <input name="credit_card" type="hidden" value="[[+credit_card]]" />
      <input name="Billing_address" type="hidden" value="[[+billing_address]]" />
      <input name="card_type" type="hidden" value="[[+card_type]]" />
      <input name="card_number:blank" type="hidden" value="[[+card_number]]" />
      <input name="ccv" type="hidden" value="none" />
      <input name="expiration_date" type="hidden" value="[[+expiration]]" />
      <input name="product:blank" type="hidden" value="[[+product]]" />
      <input name="reference_number" type="hidden" value="[[+reference_number]]" />
      <input name="represenative" type="hidden" value="[[+representative]]" />
      
      <br>
      
      <br class="clear" />
               
              <div class="form-buttons">
                  <input type="submit" name="registerbtn" value="Register" />
              </div>
        </form>
      </div>


      It hasn’t been very long but I’m hoping someone that has experience with Login can give me some clues. Thanks in advance. At this point I’d be happy to hire a consultant to walk me through.
        • 22019
        • 390 Posts

        1. Your hidden fields will show up as Extended Fields for an individual user - only accessible by default under ’Manage Users> Select user > Update User > Extended Fields. You do not need the placeholder values, eg [[+ccv]] as you are not populating them at all. The reason they are there is if the form fails validation it will repopulate the field with the last value for that field.

        2. Your select fields will work as is, but remove [[!+fi.color:FormItIsSelected=`yes`]] and [[!+fi.color:FormItIsSelected=`no`]] as they’re FormIt hooks, not Login ones. Also change <select name=’color’> to <select name=’notifications’>

        3. The myActivationEmailTpl should contain any text you want to send them. You can use any of the placeholders from your form. eg. at it’s most basic:

        <p>[[+fullname]],</p>
         
        <p>Thanks for registering! To activate your new account, please click on the following link:</p>
         
        <p><a href="[[+confirmUrl]]">[[+confirmUrl]]</a></p>
         
        <p>After activating, you may login with your password and username:</p>
         
        <p>
        Username: <strong>[[+username]]</strong><br />
        Password: <strong>[[+password]]</strong></p>
          Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
          • 25308
          • 46 Posts
          UPDATE: The last version of the registration form I made for the login package worked. Everything but the yes / no select field for the "would you like to receive promotions" question. I didn’t really expect that one to work though,...Still not sure how to use that one.

          Not sure if anyone is reading these post (as I haven’t heard anything). Just thought I’d pass it along after I saw that it created the users in the correct user group.

          Once I’m completed I"m going to write up a tut to post on here. I’m sure there’s a lots of people who need it just like I do.

          Back to it.... grin
            • 25308
            • 46 Posts
            Having my registration form add customers to the proper user group is as far as I’ve gotten. Unfortunately the prehooks aren’t working as expected.

            Register pre-hooks
            [[!Register? &submitVar=`registerbtn` &activation=`0` &usergroups=`customers` &submittedResourceId=`23` ]] 


            Login pre-hooks
            [[!Login? &loginResourceId='13' &successMsg= 'You are now logged in' &logoutResourceId='1']]  


            neither is redirecting to page specified.

            Still flying blind but trying the best I can.

              • 22019
              • 390 Posts
              That Login call needs backticks ` not apostrophes ’
              [[!Login? &loginResourceId=`13` &successMsg= `You are now logged in` &logoutResourceId=`1`]]  


              Neither call is using pre-hooks, FWIW. If you’re trying to use these calls as pre-hooks on another Register/Login call, I don’t think that will work.
                Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                • 25308
                • 46 Posts
                Quote from: odeclas at Mar 28, 2011, 11:17 AM

                That Login call needs backticks ` not apostrophes ’
                [[!Login? &loginResourceId=`13` &successMsg= `You are now logged in` &logoutResourceId=`1`]]  


                Neither call is using pre-hooks, FWIW. If you’re trying to use these calls as pre-hooks on another Register/Login call, I don’t think that will work.


                Thank you so much odeclas! I appreciate your responses. I am primarily a graphic/css web designer. I’m still cutting my teeth on Modx Revolution. I will implement the suggestions you’ve made and let you know how it goes. Thank you so much again! I’m taking baby steps here but will your help I just made a little leap. ; )
                  • 25308
                  • 46 Posts
                  Quote from: odeclas at Mar 24, 2011, 12:42 PM


                  3. The myActivationEmailTpl should contain any text you want to send them. You can use any of the placeholders from your form. eg. at it’s most basic:

                  <p>[[+fullname]],</p>
                   
                  <p>Thanks for registering! To activate your new account, please click on the following link:</p>
                   
                  <p><a href="[[+confirmUrl]]">[[+confirmUrl]]</a></p>
                   
                  <p>After activating, you may login with your password and username:</p>
                   
                  <p>
                  Username: <strong>[[+username]]</strong><br />
                  Password: <strong>[[+password]]</strong></p>


                  Where do I put this resource? Do I need to crate a chunk or new page for it? Thanks for your patience. grin
                    • 22019
                    • 390 Posts
                    Yes, myActivationEmailTpl is a chunk. I looked again, and I think there is a default chunk called that under Login category in chunks anyway, but create it if not.
                      Writer > E-consultant > MODx developer || Salesforce || modx 2.x || PHP 5.2.13 || MySQL client 5.0.86
                      • 25308
                      • 46 Posts
                      Quote from: odeclas at Mar 30, 2011, 03:13 PM

                      Yes, myActivationEmailTpl is a chunk. I looked again, and I think there is a default chunk called that under Login category in chunks anyway, but create it if not.

                      Just smacked my own forehead.

                      Thank you, I didn’t see the emailtpl file but I wasn’t looking in the right place.

                      Uhg,... such a silly mistake.

                      Thanks again!