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

  • Home
  • SEARCH
  • 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 8020145
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:36:14+00:00 2026-06-04T21:36:14+00:00

Here is my form (it only contains the fields required for this exercise, there

  • 0

Here is my form (it only contains the fields required for this exercise, there are actually 20 entry fields):

<form id="reg_form" action="/register_submit" method="post">
  <fieldset>
      <ul class="form-list">
        <li>
          <div style="width:500">
            <label for="Username" class="required">Username (5 characters minimum,<br />Only Letters, Numbers, '~', '%', '.', ':', '-' and '_' allowed)<em>*</em></label><br />
            <div class="input-box">
              <input type="text" name="Username" id="Username" value="{embed:Username}" title="Username" class="validate[required,minSize[5],custom[onlyLetNumSpec]] register_input" />
            </div>
          </div>
        </li>
        <li id="register-customer-password">
          <div style="width:500">
            <label for="Password" class="required">Password (5 characters minimum,<br />Only Letters, Numbers, '~', '%', '.', ':', '-' and '_' allowed)<em>*</em></label><br />
            <div class="input-box">
              <input type="Password" name="Password" id="Password" title="Password" class="validate[required,minSize[5],custom[onlyLetNumSpec]] register_input" />
            </div>
          </div>
          <br />
          <div style="width:500">
            <label for="confirm_password" class="required">Confirm Password<em>*</em></label>
            <div class="input-box">
              <input type="password" name="confirm_password" title="Confirm Password" id="confirm_password" class="validate[required,custom[onlyLetNumSpec],equals[Password],funcCall[checkUserPass]] register_input" />
            </div>
          </div>
          <div class="clear"></div>
         </li>
      </ul>
      <div class="button-set">
        <button class="button button-login" title="Create Account" type="submit">
          <span>
            <span>Create Account</span>
          </span>
        </button>
      </div>
  </fieldset>
</form>

Now, this is the function checkUserPass that is called on the validation after the confirm_password form field is filled and exited:

function checkUserPass(field, rules, i, options){
  $.ajax({type:'POST',
          url: '/json_api/ParticipantSelectByUser/', 
          data: {"Username":$("#Username").val(), "Password":$("#Password").val()},
          dataType: 'json', 
          success: checkUserPassResult,
          error:function (xhr, ajaxOptions, thrownError){
              alert(xhr.status);
              alert(thrownError);
          } // error
  });
}

function checkUserPassResult(data) {
  if(data.result.ParticipantID > 0) {
    /*--- There is already a user with this combination ---*/
    return options.allrules.checkUserPass.alertText;
  } // if(data.result)
}

I KNOW that there is a data.result returned and as such, there is already a user with that user/pwd combination.

However, there is never a validation message shown. I believe I have followed the correct way to do validation with a function call. I cannot use an ajax validation rule because of the need to pass both username and password to the ajax call. What seems to be the problem here? All my other validations on this form work just fine.

Here are the custom rules required for the above validations:

"onlyLetNumSpec": {
    // Good for database fields
    "regex": /^[0-9a-zA-Z_-~%.:]+$/,
    "alertText": "* Only Letters, Numbers, tilde(~), pct(%), period(.), colon(:), hyphen(-) and underscore(_) allowed"
},
"checkUserPass": {
  "alertText": "* A User with the same Username and/or Password has been detected. Please change one of the entries."
}

Edit Note; I have updated the checkUserPass function to call another funstion in success.

  • 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-04T21:36:15+00:00Added an answer on June 4, 2026 at 9:36 pm

    You are using async ajax, so your return value is returned nowhere. You will have to call a function with your data. And you will have to prevent the submit with e.preventDefault() (!!!) outside the ajax function.

    if(data.result) {
        function_to_validate_the_data(data.result);
    } // if(data.result)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have a simple form (only extract fields here) but for some reason the JQserilization
The current form is here . It is not complete, and only a couple
I modified this simple countdown timer form here: https://github.com/lunaryorn/snippets/blob/master/qt4/countdown.py as follows. Now I want
I have this form right here, where the user will add the start date
I have a form with 4 fields First Name (required) Last Name (required) Email
I have a form contains text fields,a textView and 2 switches.Now I am using
I have a Word document that contains about 4000 form fields which I have
I have a HTML form that contains text fields, checkboxes, radiobuttons and a submit
Trying to upload a form with a file input, only getting the form fields
To give more information I am using the modular form here: http://jqueryui.com/demos/dialog/#modal-form `b(e.target).zIndex` is

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.