Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7919909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T16:01:30+00:00 2026-06-03T16:01:30+00:00

hi i have a sign up form , it has six input fields html

  • 0

hi i have a sign up form , it has six input fields

html code

<div id="signup">
    <form  id="suform" method="POST" action="signup/newUser">
        <p>
            <label>Frist Name</label>
            <input type="text" name="fName"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Last Name</label>
            <input type="text" name="lName"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Email</label>
            <input type="text" name="Email"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Mobile Number</label>
            <input type="text" name="MNumber"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Password</label>
            <input type="password" name="Password"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <label>Re Password</label>
            <input type="password" name="RePassword"/>
            <span class="errorMessage"></span>
        </p>
        <p>
            <input type="submit" class="button" value="sign up"/>
        </p>
    </form>
</div>

when the user clicked sign up button , first i ensure that no input fields is empty , if i found any input fields in empty then i print an error message left to that input field ,

jquery code

$(document).ready(function(){
    $('#suform').on('submit', function(e){
        e.preventDefault();
        var errorCount = 0;
        $('span.errorMessage').text(''); // reset all error mesaage
        $('input').each(function(){
            var $this = $(this);
            if($this.val() === ''){
                var error = 'Please fill ' + $this.prev('label').text(); // take the input field from label
                $this.next('span').text(error);
                errorCount = errorCount + 1;   
            }
        });
        if(errorCount === 0){
            $(this)[0].submit(); // submit form if no error
        }
    });
});

i want the user to input his password twice to ensure that he saves it

my question is how to check the two passwords input fields if they are equal or not , and if not i want to print a message error to the left of that two input fields

code

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T16:01:34+00:00Added an answer on June 3, 2026 at 4:01 pm

    You can do it like that:

    var pass1 = $('input[name=Password]').val();
    var pass2 = $('input[name=RePassword]').val();
    if(pass1 != '' && pass1 != pass2) {
        //show error
        var error = 'Password confirmation doesn\'t match.';
        $('input[name=Password]').next('span').text(error);
        $('input[name=RePassword]').next('span').text(error);
        errorCount = errorCount + 1;   
    }
    

    The “for” property in the label is used as follows:

    <label for="myPasswordField">
        <input type="password" id="myPasswordField" name="Password" />
    </label>
    

    So when you click on the label this will set the focus on the related element with that ID attribute.

    To check if the phone field is a number you need that:

    var mobile = $('input[name=MNumber]').val();
    if(isNaN(parseFloat(mobile )) && !isFinite(mobile )) {
        var error = 'Mobile number incorect.';
        $('input[name=MNumber]').next('span').text(error);
        errorCount = errorCount + 1; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple email form: <form method=post action=process-form.php id=emailForm name=emailForm target=_self> <h4>Sign up
I created this form: <form method=post action=process-form.php id=emailForm name=emailForm target=_self> <h4>Sign up to be
I have an iPad application which has a sign up form within it. The
I have a signup form of which most fields are pre-filled using user's Facebook
I have a sign-up form that has nested associations/attributes whatever you want to call
I have a .NET powered website, that has a sign-up box form already. I'm
I have a sign in form and a lost password form. Currently in my
I have designed one sign-up form,in this form after getting all necessary values I
I have a certificate code sign and an app mobileprovision for a mac. Is
I have a sign in form with inputs that have a white background and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.