Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am trying to create a custom modal registration form, but I'm experiencing difficulties with validating the form. Basically what I have managed to do was to use CSS3 to validate the fields based on the pattern="..." orrequired markup used in the <input> tags.

This validation covers simple stuff like checking for password's min. chars and email address syntax. However, what's missing, and very important, is a way for the form to check back with the database to see if the email address a new user wants to register with, is already registered with the website...and if so trigger <i class="icon-attention invalid"></i> to display and if possible make the submit button disabled.

<div class="modal modal-animate" id="login">
<div class="modal-content">
    <section id="modal-register" class="hidden">
            <h4>Sign up for a new account</h4>
            <form enctype="multipart/form-data" method="post" class="frm-show-form " id="form_registration">
            <ul>
              <input type="hidden" name="frm_action" value="create">
              <input type="hidden" name="form_id" value="10">
              <input type="hidden" name="form_key" value="registration">
              <li class="field">
                 <input type="text" id="field_first_name" class="input" name="item_meta[85]" value="" placeholder="First Name" required><i class="icon-check valid"></i><i class="icon-attention invalid"></i>
              </li>
              <li class="field">
                 <input type="text" id="field_last_name" class="input" name="item_meta[86]" value="" placeholder="Last Name" required><i class="icon-check valid"></i><i class="icon-attention invalid"></i>
             </li>
             <li class="field">
                 <input type="email" id="field_email_address" class="input" name="item_meta[87]" value="" placeholder="Email" required><i class="icon-check valid"></i><i class="icon-attention invalid"></i>
             </li>
             <li class="field">
                 <input type="password" id="field_password" class="input" name="item_meta[88]" value="" placeholder="Password" pattern=".{6,}" required><i class="icon-check valid"></i><i class="icon-attention invalid"></i>
             </li>
             <input type="hidden" id="field_r5tog4" name="item_meta[89]" value="" />
             <input type="hidden" name="item_key" value="" />
             <input type="hidden" name="frm_register[username]" value="-1" />
             <input type="hidden" name="frm_register[email]" value="87" />
           </ul>
           <input type="submit" value="Register" formnovalidate="formnovalidate" class="button-full">
           </form>
    </section>
</div>
</div>

Is there some PHP script that can be used to help with validation here, or is the entire form wrong? I've tried testing it and user registration works but if the email is taken, the page just refreshes without registering anything. If it is a valid new email being used, registration works.

share|improve this question
2  
What does this have to do with WordPress? –  Wyck Aug 28 '13 at 6:14
    
It's a wordpress registration form. –  Jeremy Aug 29 '13 at 12:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.