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

    Im not sure what I’m doing wrong. The problem is that the

    <span class="error">Error</span>
    code appears only around some items in my form and not all.

    Using Login 1.6.4, here is my chunk

    [[!Register?
       &activationEmailTpl=`myform.register.emailTpl`
       &activationEmailSubject=`[CLIENTNAME] Please confirm your e-mail address`
       &activationResourceId=`64`
       &usergroups=`freeusers`
       &submittedResourceId=`97`
       &activationttl=`1440`
       &usernameField=`rusername`
       &emailField=`rusername`
       &passwordField=`rpassword`
       &preHooks=`hook.emailValue`
       &postHooks=`hook.emailNotify`
    &errTpl=`<span class="error">[[+error]]</span>`
    &validate=`workemail:blank,
      rusername:required:email,
      rpassword:required:minLength=^8^,
      password_confirm:password_confirm=^rpassword^,
      fullname:required`
       &submitVar=`register-submit`
    ]]
    
    
    [[!+error.message:notempty=`<div class="registerMessage">[[+error.message]]</div>`]]
    
    <p>All fields are required</p>
    <form action="[[~[[*id]]]]" method="post" class="form" id="registrationForm">
      <fieldset>
    <input type="hidden" name="workemail" value="" />
    
    
        <label for="fullname"><span class="label">Your full name:</span>
    <span class="input"><input name="fullname" id="fullname"  type="text" value="[[+fullname]]" />
      [[!+error.fullname]]
    </span></label>
    
        <label for="rusername"><span class="label">Your E-mail:</span>
          <span class="input"><input name="rusername" id="rusername"  type="text" value="[[+rusername]]" />
      [[!+error.rusername]]
    </span></label>
    
        <label for="rpassword"><span class="label">Password:</span>
    <span class="input"><input name="rpassword" id="rpassword"  type="password" value="[[+rpassword]]" />
    [[!+error.rpassword]]
    </span></label>
    
        <label for="password_confirm"><span class="label">Confirm Password:</span>
          <span class="input"><input name="password_confirm" 
      id="password_confirm" type="password" value="[[+password_confirm]]" />
    [[!+error.password_confirm]]
    </span></label>
        </fieldset>
        
      <fieldset id="disclaimer">
          <label for="confirm_disclaimer">
            <span class="input-centred">
              <input type="checkbox" name="confirm_disclaimer" id="confirm_disclaimer" value="Y" [[!+confirm_disclaimer:FormItIsChecked=`Y`]] />Confirm that you have read and agree to our <a href="disclaimer" class="colorboxDisclaimer">Disclaimer</a>
    
    [[!+error.confirm_disclaimer]]
    </span></label>
    
        </fieldset> 
      
        <fieldset>
        <span class="submitButtons"><input type="submit" name="register-submit" value="Register" /></span>
      </fieldset>
    </form>
    
    



    This is what the form looks like when I don’t enter anything (to force the errors). Note the formatting. Only some of the error messages get the SPAN around them. There isnt anything visibly different between those that have the span tag and those that don’t.



    Any ideas on this? BTW there used to be a double span tag problem but that was fixed in 1.6.4.

    Thanks in advance.
    John


      • 28215
      • 4,149 Posts
      Can you post the generated HTML of the form with errors?
        shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
        • 23510
        • 168 Posts
        here’s the html (just the form tag and contents)

        <form action="ecase-start-form/" method="post" class="form" id="registrationForm">
          <fieldset>
        <input type="hidden" name="workemail" value="" />
        
        
            <label for="fullname"><span class="label">Your full name:</span>
        <span class="input"><input name="fullname" id="fullname"  type="text" value="" />
           <span class="error">This field is required.</span>
        
        </span></label>
        
            <label for="rusername"><span class="label">Your E-mail:</span>
              <span class="input"><input name="rusername" id="rusername"  type="text" value="" />
          This field is required.
        </span></label>
        
            <label for="rpassword"><span class="label">Password:</span>
        <span class="input"><input name="rpassword" id="rpassword"  type="password" value="" />
        This field is required.
        </span></label>
        
            <label for="password_confirm"><span class="label">Confirm Password:</span>
              <span class="input"><input name="password_confirm" 
          id="password_confirm" type="password" value="" />
         <span class="error">Please confirm your password.</span>
        </span></label>
            </fieldset>
            
          <fieldset id="disclaimer">
              <label for="confirm_disclaimer">
                <span class="input-centred">
        
                  <input type="checkbox" name="confirm_disclaimer" id="confirm_disclaimer" value="Y"  checked="checked" />Confirm that you have read and agree to our <a href="disclaimer" class="colorboxDisclaimer">Disclaimer</a>
        
        </span></label>
        
            </fieldset> 
            
            <fieldset>
            <span class="submitButtons"><input type="submit" name="register-submit" value="Register" /></span>
          </fieldset>
        </form>
        
        
        
        
          • 23510
          • 168 Posts
          Forgot to mention that I am running Revo 2.1.2
            • 23510
            • 168 Posts
            For now my workaround is to manually insert the span class=error tag around each error in the html code and remove it from the &errTpl.

            Thanks.
              • 23510
              • 168 Posts
              Ok some good news. Login 1.6.5 fixed the span tags wrapping around the error messages. No issues there, but now when I submit a blank form I get three different error messages for a field. I edited the &validate lines to:

              &validate=`workemail:blank,
                rusername:email,
                rpassword:minLength=^8^,
                password_confirm:password_confirm=^rpassword^,
                fullname:required`
              


              removing the ’required’ text from the rusername and rpassword fields but I still get the error messages popping up twice:

                <fieldset>
              <input type="hidden" name="workemail" value="" />
              
              
                  <label for="fullname"><span class="label">Your full name:</span>
              <span class="input"><input name="fullname" id="fullname"  type="text" value="" />
                 <span class="error">This field is required.</span>
              
              </span></label>
              
                  <label for="rusername"><span class="label">Your E-mail:</span>
                    <span class="input"><input name="rusername" id="rusername"  type="text" value="" />
              	 <span class="error">This field is required.</span> <span class="error">This field is required.</span>
              </span></label>
              
                  <label for="rpassword"><span class="label">Password:</span>
              
              <span class="input"><input name="rpassword" id="rpassword"  type="password" value="" />
               <span class="error">This field must be at least 8 characters long.</span> <span class="error">This field is required.</span>
              </span></label>
              
                  <label for="password_confirm"><span class="label">Confirm Password:</span>
                    <span class="input"><input name="password_confirm" 
                id="password_confirm" type="password" value="" />
               <span class="error">Please confirm your password.</span>
              </span></label>
              
                  </fieldset>
              	
              	


              Slightly off topic question. Can I just move all of the validation to preHooks? (Although from the documentation, the preHooks take place *after* validation).
                • 7045
                • 225 Posts
                I have the exact same problems as you, and I tried the exact fixes as you with the same results. I will let you know if i find a fix, but I think we will have to wait for a login snippet update.
                  • 23510
                  • 168 Posts
                  Glad to know I’m not the only one. I’ve resorted to output filters to use my own validation messages. Not as clean code as I’d like.
                    • 7045
                    • 225 Posts
                    Found it, and I believe you have a similar setup that triggers this double error message. I am using my email field for my username as well. So I have the following added to my call:

                    &usernameField=`email`
                    


                    I pulled all validation references to email out of my call, but I left [[!+error.email]] next to the email field. I still got the double message. However, when I removed &usernameField=`email` from my call, I only get a single error message.

                    Long story short, there is either a validation bug when you use your email as your username, or we have it setup incorrectly.