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 9129677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:48:13+00:00 2026-06-17T07:48:13+00:00

When I attempt to create a method to use the methods provided in the

  • 0

When I attempt to create a method to use the methods provided in the additional-methods.js file I get the intended validation. However, if the user inputs a wrong value, instead of displaying the exception defined in the additional-methods.js file, the user sees the title of the current element, which is currently being used for type-hinting.

My JavaScript looks like this:

  //setup input validation
                validator = form.validate({
                    rules: {
                        city: {
                            required: true,
                            lettersonly: true
                        }
                    }
                }); 

  $('input, textarea').blur(function(){
                    element = $(this);

                    // if the user gave no value then show the this field is required
                    if(element.val() == element.attr('title')){ 
                        refreshError(element, 'This field is required');
                    }else if(element.val() == '') {  //if the value is empty then check if it was required, also check if it had an input hint
                        //if the element is required display the error message
                        if(element.hasClass('required')){ 
                            refreshError(element, 'This field is required');
                        }

                        //if the title exists then we assume it is the input hint
                        if(element.attr('title') != ''){
                            element.val(element.attr('title'));
                            element.addClass('inputHint');
                        }
                    }else{
                        //if we got input validate it
                        response = element.valid();
                        //if we got an error clear the old one(conditional on existance), and display the new one. Otherwise clear any old error
                        if(!response){
                            this.defaultShowErrors();
                        }else{
                            errorId = element.attr('id')+'Error';
                            $('#'+errorId).remove();
                        }
                    }
                });

With the relevant part of the form being:

<label for="city">City:</label>
<input type="text" name="city" id="city" class="required inputHint" title="Your city here" />

Any ideas as to what I am doing wrong? I am using the 1.9.0 version of the jQuery Validator plugin

NB: I thought I had hit the nail on the head after reading: addMethod() of jQuery validation plugin display error from title attribute but after trying:

                    //setup input validation
                validator = form.validate({
                    rules: {
                        city: {
                            required: true,
                            lettersonly: true
                        }
                    },
                    messages: {
                        city: {
                            lettersonly: "you must give a valid city"
                        }
                    }
                }); 

I found that nothing changed.

  • 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-17T07:48:14+00:00Added an answer on June 17, 2026 at 7:48 am

    I just ran into this error and came across the ignoreTitle option:

    //setup input validation
    validator = form.validate({
        ignoreTitle: true,
        rules: {
            city: {
                required: true,
                lettersonly: true
            }
        },
        messages: {
            city: {
                lettersonly: "you must give a valid city"
            }
        }
    }); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm after a simple stored procedure to drop tables. Here's my first attempt: CREATE
Continuing on my attempt to create a DateTime class , I am trying to
I found only one attempt to create such compiler - http://sourceforge.net/projects/xsltc/ . But this
This is my first attempt to create a GUI in MATLAB. I haven't been
In the following code, I attempt to create an SVG circle on the screen
I'm trying to create a simple threading procedure (granted this is my first attempt
I've decided to take the advice in this question: create-excel-chart-programmatically-in-php and NOT attempt to
What follows is an initializer method. It creates a Movie structure from a file,
Both iterators and async methods create a state machine for keeping the state between
I am trying to use an instance method as a callback for PHP 5.2.1.

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.