Giter VIP home page Giter VIP logo

jquery-validation-engine's Introduction

jQuery.validationEngine v3.1.0

Looking for official contributors

This project has now been going on for more than 7 years, right now I only maintain the project through pull request contributions. However, I would love to have help improving the code quality and maintain an acceptable level of open issues.

Summary

jQuery validation engine is a Javascript plugin aimed at the validation of form fields in the browser (IE 6-8, Chrome, Firefox, Safari, Opera 10). The plugin provides visually appealing prompts that grab user attention on the subject matter.

Validations range from email, phone, and URL, to more complex calls such as ajax processing or custom javascript functions. Bundled with many locales, the error prompts can be translated into the language of your choice.

Screenshot

Documentation :

Installation

What's in the archive?

Download

tar.gz 3.0.0 or zip 3.0.0

The archive holds, of course, the core library along with translations in different languages. It also comes with a set of demo pages and a simple ajax server (built in Java and php).

  1. Unpack the archive
  2. Include the script jquery.validationEngine.closure.js in your page
  3. Pick the locale of the choice and include it in your page: jquery.validationEngine-XX.js
  4. Read this manual and understand the API

Usage

References

First include jQuery on your page

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js" type="text/
javascript"></script>

Include jquery.validationEngine and its locale

<script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>

Finally include the desired theme

<link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/>

Field Validations

Validations are defined using the field's class attribute. Here are a few examples showing how it happens:

<input value="[email protected]" class="validate[required,custom[email]]" type="text" name="email" id="email" />
<input value="2010-12-01" class="validate[required,custom[date]]" type="text" name="date" id="date" />
<input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special" />

For more details about validators, please refer to the section below.

Experimental attribute data-validation-engine

We are currently in the process of replaceing the class attribute by something more standard, it should normally work but consider this feature in beta.

Standard HTML5 attribute for error message

Customize error messages with data-errormessage and data-errormessage-* attributes on the form elements. For example:

<input type="email" name="email" id="email" data-validation-engine="validate[required,custom[email]]"
	data-errormessage-value-missing="Email is required!" 
	data-errormessage-custom-error="Let me give you a hint: [email protected]" 
	data-errormessage="This is the fall-back error message."/>

The following attribute's value will be loaded for the relative validation rule:

data-errormessage-value-missing
  • required
  • groupRequired
  • condRequired
data-errormessage-type-mismatch
  • past
  • future
  • dateRange
  • dateTimeRange
data-errormessage-pattern-mismatch
  • creditCard
  • equals
data-errormessage-range-underflow
  • minSize
  • min
  • minCheckbox
data-errormessage-range-overflow
  • maxSize
  • max
  • maxCheckbox
data-errormessage-custom-error
  • custom
  • ajax
  • funcCall
data-errormessage
  • a generic fall-back error message

Per Field Prompt Direction

Prompt direction can be define using the field's data attribute. Here are a few examples showing how it happens:

<input value="http://" class="validate[required,custom[url]] text-input" type="text" name="url" id="url" data-prompt-position="topLeft" />
<input value="" class="validate[required] text-input" type="text" name="req" id="req" data-prompt-position="bottomLeft" />
<input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special" data-prompt-position="bottomRight" />

Prompt Position Adjustment

Prompt position can be adjusted by providing shiftX and shiftY with position type in the field's data attribute. Prompt will be placed in (defaultX+shiftX),(defaultY+shiftY) position instead of default for selected position type. Here are a few examples showing how it happens:

<input value="http://" class="validate[required,custom[url]] text-input" type="text" name="url" id="url" data-prompt-position="topLeft:70" />
<input value="" class="validate[required] text-input" type="text" name="req" id="req" data-prompt-position="bottomLeft:20,5" />
<input value="too many spaces obviously" class="validate[required,custom[onlyLetterNumber]]" type="text" name="special" id="special" data-prompt-position="bottomRight:-100,3" />

Instantiation

The validator is typically instantiated with a call in the following format, the plugin can only be instanciated on form elements:

$("#form.id").validationEngine();

Without any parameters, the init() and attach() methods are automatically called.

$("#form.id").validationEngine(action or options);

The method may take one or several parameters, either an action (and parameters) or a list of options to customize the behavior of the engine.

Here's a glimpse: say you have a form as such:

<form id="formID" method="post" action="submit.action">
    <input value="2010-12-01" class="validate[required,custom[date]]" type="text" name="date" id="date" />
</form>

The code below will instantiate the validation engine and attach it to the form:

<script>
$(document).ready(function(){
    $("#formID").validationEngine();
   });
</script>

When using options, the default behavior is to only initialize ValidationEngine, so attachment needs to be done manually.

<script>
$(document).ready(function(){
    $("#formID").validationEngine('attach', {promptPosition : "centerRight", scroll: false});
   });
</script>

All calls to validationEngine() are chainable, so one can do the following:

$("#formID").validationEngine().css({border : "2px solid #000"});

Actions

attach

Attaches jQuery.validationEngine to form.submit and field.blur events.

$("#formID1").validationEngine('attach');

detach

Unregisters any bindings that may point to jQuery.validaitonEngine.

$("#formID1").validationEngine('detach');

validate

Validates a form or field, displays error prompts accordingly.
Returns true if the form validates, false if it contains errors.

For fields, it returns false on validate and true on errors.

When using form validation with ajax, it returns undefined , the result is delivered asynchronously via function options.onAjaxFormComplete.

// form validation
alert( $("#formID1").validationEngine('validate') );

// field validation
alert( $("#emailInput").validationEngine('validate') );

showPrompt (promptText, type, promptPosition, showArrow)

Displays a prompt on a given element. Note that the prompt can be displayed on any element by providing an id.

The method takes four parameters:

  1. the text of the prompt itself
  2. a type which defines the visual look of the prompt: 'pass' (green), 'load' (black) anything else (red)
  3. an optional position: either "topLeft", "topRight", "bottomLeft", "centerRight", "bottomRight". Defaults to "topRight"
  4. an optional boolean which indicates if the prompt should display a directional arrow
<fieldset>
   <legend id="legendid">Email</legend>
   <a href="#" onclick="$('#legendid').validationEngine('showPrompt', 'This a custom msg', 'load')">Show prompt</a>
</fieldset>

hide

The hide method can be applied to a form or a field.
It closes/hides error prompts.

// closes all form prompts
$('#formID1').validationEngine('hide');

// closes onle one prompt
$('#email1').validationEngine('hide');

hideAll

Closes/hides all error prompts on the page no matter what form they are attached to.

$('#formID1').validationEngine('hideAll');

updatePromptsPosition

Update the form prompts positions.

$("#formID").validationEngine("updatePromptsPosition")    

hidePrompt & validateField

Deprecated and not part of the code base anymore.
Use hide and validate instead.

Options

Options are typically passed to the init or attach action as a parameter.

    $("#formID1").validationEngine({promptPosition : "centerRight", scroll: false});
    $("#formID1").validationEngine('attach', {promptPosition : "centerRight", scroll: false});

validationEventTrigger

Name of the event triggering field validation, defaults to blur.

scroll

Determines if we should scroll the page to the first error, defaults to true.

binded

If set to false, it removes blur events and only validates on submit.

promptPosition

Where should the prompt show? Possible values are "topLeft", "topRight", "bottomLeft", "centerRight", "bottomRight". Defaults to "topRight". Default position adjustment could also be provided.

showOneMessage

Only display the first incorrect validation message instead of normally stacking it. It will follows the validation hierarchy you used in the input and only show the first error.

ajaxFormValidation

If set to true, turns Ajax form validation logic on. Defaults to false. Form validation takes place when the validate() action is called or when the form is submitted.

ajaxFormValidationURL

If set, the ajax submit validation will use this url instead of the form action

ajaxFormValidationMethod

HTTP method used for ajax validation, defaults to 'get', can be set to 'post'

onBeforeAjaxFormValidation(form, options)

When ajaxFormValidation is turned on, this is the function that will be called before the asynchronous AJAX form validation call. May return false to stop the Ajax form validation

onAjaxFormComplete: function(status, form, errors, options)

When ajaxFormValidation is turned on, this function is used to asynchronously process the result of the validation. the status is a boolean. If true, the ajax call completed and all the server side form validations passed.

onValidationComplete

When defined, it stops by default the form from auto-submitting, and lets you handle the validation status via a function. You can also return true in this function and the form will be allowed to submit.

jQuery("#formID2").validationEngine('attach', {
  onValidationComplete: function(form, status){
    alert("The form status is: " +status+", it will never submit");
  }  
});

custom_error_messages

This is where custom messages for IDs, Classes, or validation types are stored.

Custom error messages are exclusive from one another.ID messages will be displayed instead of anything else; Class messages will only be used if there is no ID message, and only the first message found associated with one of the classes will be used; Global Validator messages will only be used if there are no Class messages or ID messages.

These custom messages are declared in this manner:

jQuery("#formID2").validationEngine({'custom_error_messages' : {
		'#someId' : {
			'required': {
				'message': "This is a custom message that is only attached to the input with id 'someId' if it
							has the validation of 'required'. This will always display, even if it has other
							custom messages."
			},
			'custom[min]': {
				'message': "This is a custom message that is only attached to the input with id 'someID' if it
							has the validation of 'custom[min[someNumber]]'. This will always display, even if
		      				it has other custom messages."
			}
		},
		'.someClass': {
			'equals': {
				'message': "This is a custom message that is only attached to inputs that have the class of
							'someClass' and the validation type of 'equals'. This will be displayed only on
							inputs without an ID message."
			}
		},
		'required' {
			'message': "This is a custom message that replaces the normal error message for the validation
						'required'. This only displays when there are no Class or ID messages."
		}
	}
});

focusFirstField

Specifies whether or not the first field in a form receives auto-focus after validation returns false. Default is set to true. If you want to disable the auto-focusing use:

$('#form').validationEngine('attach', {focusFirstField : false});

onSuccess

If set, this callback function will be called when all validations passed.

onFailure

If set, this callback function will be called when it found an error.

autoPositionUpdate

Auto update prompt position after window resize, disabled by default

autoHidePrompt

Determines if the prompt should hide itself automatically after a set period. Defaults to false.

autoHideDelay

Sets the number of ms that the prompt should appear for if autoHidePrompt is set to true. Defaults to 10000.

showArrow

Show the arrow in the validation popup. Defaults to true

showArrowOnRadioAndCheckbox

Show the arrow in the validation popup when validating checkboxes and radio buttons. Defaults to false

Validators

Validators are encoded in the field's class attribute, as follows

required

Speaks for itself, fails if the element has no value. This validator can apply to pretty much any kind of input field.

<input value="" class="validate[required]" type="text" name="email" id="email" />
<input class="validate[required]" type="checkbox" id="agree" name="agree"/>

<select name="sport" class="validate[required]" id="sport">
   <option value="">Choose a sport</option>
   <option value="option1">Tennis</option>
   <option value="option2">Football</option>
   <option value="option3">Golf</option>
</select>

groupRequired

At least one of the field of the group must be filled. It needs to be given a group name that is unique across the form.

<input value="" class="validate[groupRequired[payments]]" type="text" name="creditcard" id="creditcard" />
<input class="validate[groupRequired[payments]]" type="text" id="paypal" name="paypal"/>

condRequired

This makes the field required, but only if any of the referred fields has a value.

<input value="" type="text" name="creditcard" id="creditcard" />
<input class="validate[condRequired[creditcard]]" type="text" id="ccv" name="ccv"/>

custom[regex_name]

Validates the element's value to a predefined list of regular expressions.

<input value="[email protected]" class="validate[required,custom[email]]" type="text" name="email" id="email" />

Please refer to the section Custom Regex for a list of available regular expressions.

custom[function_name]

Validates the element's value to a predefined function included in the language file (compared to funcCall that can be anywhere in your application),

<input value="[email protected]" class="validate[required,custom[requiredInFunction]]" type="text" name="email" id="email" />

Please refer to the section Custom Regex for a list of available regular expressions.

funcCall[methodName]

Validates a field using a third party function call. If a validation error occurs, the function must return an error message that will automatically show in the error prompt.

function checkHELLO(field, rules, i, options){
  if (field.val() != "HELLO") {
     // this allows the use of i18 for the error msgs
     return options.allrules.validate2fields.alertText;
  }
}

The following declaration will do

<input value="" class="validate[required,funcCall[checkHELLO]]" type="text" id="lastname" name="lastname" />

ajax[selector]

Delegates the validation to a server URL using an asynchronous Ajax request. The selector is used to identify a block of properties in the translation file, take the following for example.

** The validation execution order is taken form the order you put them in the HTML, it is recommended to always put the ajax[] validation last. For example, the custom events might fail if you put ajax[] in the middle. Ajax[] works on submit since 2.6.

<input value="" class="validate[required,custom[onlyLetterNumber],maxSize[20],ajax[ajaxUserCall]] text-input" type="text" name="user" id="user" />
"ajaxUserCall": {
    "url": "ajaxValidateFieldUser",
    "extraData": "name=eric",
    "extraDataDynamic": ['#user_id', '#user_email'],
    "alertText": "* This user is already taken",
    "alertTextOk": "All good!",
    "alertTextLoad": "* Validating, please wait"
},
  • url - is the remote restful service to call
  • extraData - optional parameters to send
  • extraDataDynamic - optional DOM id's that should have their values sent as parameters
  • alertText - error prompt message if validation fails
  • alertTextOk - optional prompt if validation succeeds (shows green)
  • alertTextLoad - message displayed while the validation is being performed

This validator is explained in further details in the Ajax section.

equals[field.id]

Checks if the current field's value equals the value of the specified field.

min[float]

Validates when the field's value is less than, or equal to, the given parameter.

max[float]

Validates when the field's value is more than, or equal to, the given parameter.

minSize[integer]

Validates if the element content size (in characters) is more than, or equal to, the given integer. integer <= input.value.length

maxSize[integer]

Validates if the element content size (in characters) is less than, or equal to, the given integer. input.value.length <= integer

past[NOW, a date or another element's name]

Checks if the element's value (which is implicitly a date) is earlier than the given date. When "NOW" is used as a parameter, the date will be calculate in the browser. When a "#field name" is used ( The '#' is optional ), it will compare the element's value with another element's value within the same form. Note that this may be different from the server date. Dates use the ISO format YYYY-MM-DD

<input value="" class="validate[required,custom[date],past[now]]" type="text" id="birthdate" name="birthdate" />
<input value="" class="validate[required,custom[date],past[2010-01-01]]" type="text" id="appointment" name="appointment" />
<input value="" class="validate[required,custom[date],past[#appointment]]" type="text" id="restaurant" name="restaurant" />
<input value="" class="validate[required,custom[date],past[appointment]]" type="text" id="restaurant_2" name="restaurant_2" />

future[NOW, a date or another element's name]

Checks if the element's value (which is implicitly a date) is greater than the given date. When "NOW" is used as a parameter, the date will be calculate in the browser. When a "#field name" is used ( The '#' is optional ), it will compare the element's value with another element's value within the same form. Note that this may be different from the server date. Dates use the ISO format YYYY-MM-DD

<input value="" class="validate[required,custom[date],future[now]]" type="text" id="appointment" name="appointment" />
<input value="" class="validate[required,custom[date],future[#appointment]]" type="text" id="restaurant" name="restaurant" />
// a date in 2009
<input value="" class="validate[required,custom[date],future[2009-01-01],past[2009-12-31]]" type="text" id="d1" name="d1" />

minCheckbox[integer]

Validates when a minimum of integer checkboxes are selected. The validator uses a special naming convention to identify the checkboxes as part of a group.

The following example, enforces a minimum of two selected checkboxes

<input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck1" value="5"/>
<input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck2" value="3"/>
<input class="validate[minCheckbox[2]]" type="checkbox" name="group1" id="maxcheck3" value="9"/>

Note how the input.name is identical across the fields.

maxCheckbox[integer]

Same as above but limits the maximum number of selected check boxes.

creditCard

Validates that a credit card number is at least theoretically valid, according the to the Luhn checksum algorithm, but not whether the specific card number is active with a bank, etc.

Selectors

We've introduced the notion of selectors without giving many details about them: A selector is a string which is used as a key to match properties in the translation files. Take the following example:

"onlyNumber": {
    "regex": /^[0-9\ ]+$/,
    "alertText": "* Numbers only"
},
"ajaxUserCall": {
    "url": "ajaxValidateFieldUser",
    "extraData": "name=eric",
    "alertText": "* This user is already taken",
    "alertTextOk": " * User is valid",
    "alertTextLoad": "* Validating, please wait"
},
"validate2fields": {
    "alertText": "* Please input HELLO"
}

onlyNumber, onlyLetter and validate2fields are all selectors. jQuery.validationEngine comes with a standard set but you are welcome to add you own to define AJAX backend services, error messages and/or new regular expressions.

The ValidationEngine with a datepicker

Using a datepicker with the engine is problematic because the validation is bound to the blur event. since we lose the focus before any data is entered in the field it creates a weird bug. Fortunately we implemented a fix that uses a delay during the datepicker binding.

To use this mode you need to add the class datepicker to your input, like this:

<input type="text" id="req" name="req" class="validate[required] text-input datepicker" value="">

Ajax Protocol

The ajax validator takes a selector as an attribute. the selector points to a structure that defines the URL to call, the different messages to display and any extra parameters to add on the URL (when applicable). Please refer to the ajax[selector] description for more details.

Ajax validation comes in two flavors:

  1. Field Ajax validations, which take place when the user inputs a value in a field and moves away.
  2. Form Ajax validation, which takes place when the form is submitted or when the validate() action is called.

Both options are optional.

<input value="" class="validate[required,ajax[ajaxUserCall]] text-input" type="text" name="user" id="user" />

You can see a tutorial that makes the use of php here: http://www.position-absolute.com/articles/using-form-ajax-validation-with-the-jquery-validation-engine-plugin/

Field ajax validation

Protocol

The client sends the fieldId and the fieldValue as a GET request to the server url.

Client calls url?fieldId=id1&fieldValue=value1 ==> Server

Server responds with an array: [fieldid, status, errorMsg].

Client receives <== ["id1", boolean, errorMsg] Server
  • fieldid is the name (id) of the field
  • status is the result of the validation, true if it passes, false if it fails
  • errorMsg is an optional error string (or a selector) to the prompt text. If no error msg is returned, the prompt message is expected to be part of the rule with key "alertText" or "alertTextOk" (see the structure of the translation file)

Form ajax validation

Protocol

The client sends the form fields and values as a GET request to the form.action url.

Client calls url?fieldId=id1&fieldValue=value1&...etc ==> Server (form.action)

Server responds with an array of arrays: [fieldid, status, errorMsg].

  • fieldid is the name (id) of the field

  • status is the result of the validation, true if it passes, false if it fails

  • errorMsg is an error string (or a selector) to the prompt text

    Client receives <== [["id1", boolean,"errorMsg"],["id2", false, "there is an error "],["id3", true, "this field is good"]]

Note that normally errors (status=false) are returned from the server. However you may also decide to return an entry with a status=true in which case the errorMsg will show as a green prompt.

Validation URL

By default the engine use the form action to validate the form, you can however set a default url using:

**ajaxFormValidationURL

Callbacks

Since the form validation is asynchronously delegated to the form action, we provide two callback methods:

onBeforeAjaxFormValidation(form, options) is called before the ajax form validation call, it may return false to stop the request

onAjaxFormComplete: function(form, status, json_response_from_server, options) is called after the ajax form validation call

Custom Regex

jQuery.validationEngine comes with a lot of predefined expressions. Regex validation rules are specified as follows:

<input value="" class="validate[custom[email]]" type="text" name="email" id="email" />

Note that the selector identifies a given regular expression in the translation file, but also its associated error prompt messages and optional green prompt message.

phone

a typical phone number with an optional country code and extension. Note that the validation is relaxed, please add extra validations for your specific country.

49-4312 / 777 777
+1 (305) 613-0958 x101
(305) 613 09 58 ext 101
3056130958
+33 1 47 37 62 24 extension 3
(016977) 1234
04312 - 777 777
91-12345-12345
+58 295416 7216

url

Matches a URL such as http://myserver.com, https://www.crionics.com or ftp://myserver.ws

email

Easy, an email : [email protected]

date

An ISO date, YYYY-MM-DD

number

Floating points with an optional sign. ie. -143.22 or .77 but also +234,23

integer

Integers with an optional sign. ie. -635 +2201 738

ipv4 and ipv6

An IP address (v4) ie. 127.0.0.1 or v6 2001:0db8:85a3:08d3:1319:8a2e:0370:7344

onlyNumberSp

Only numbers and spaces characters

onlyLetterSp

Only letters and space characters

onlyLetterNumber

Only letters and numbers, no space

Position fixed and overflow scroll

Before 2.5.3 some options were needed to use the engine in a div with overflow scroll or position fixed, now you just have to set position relative on the form and you are good to go.

Placeholders

The engine support by default placeholders when a field is required. use the attribute data-validation-placeholder in the input to define it.

Hooks

The plugin provides some hooks using jQuery bind functionality.

  • jqv.form.validating : Trigger when the form is submitted and before it starts the validation process
  • jqv.field.result(event, field, errorFound, prompText) : Triggers when a field is validated with the result.
  • jqv.form.result(event, errorFound) : Triggers when a form is validated with the result

An example of binding a custom function to these events would be:

$("#formID").bind("jqv.form.result", function(event, errorFound) {
  if(errorFound)
     alert("There is a problem with your form");
});

Customizations

What would a good library be without customization?

Adding regular expressions

Adding new regular expressions is easy: open your translation file and add a new entry to the list

"onlyLetter": {
    "regex": /^[a-zA-Z\ \']+$/,
    "alertText": "* Letters only"
},
  • "onlyLetter" is a sample selector name
  • "regex" is a javascript regular expression
  • "alertText" is the message to display when the validation fails

You can now use the new regular expression as such

<input type="text" id="myid" name="myid" class="validation[custom[onlyLetter]]"/>

Don't forget to contribute!

Customizing the look and feel

Edit the file validationEngine.jquery.css and customize the stylesheet to your liking. it's trivial if you know CSS.

Adding more locales

You can easily add a locale by taking jquery.validationEngine-en.js as an example. Feel free to share the translation ;-)

Changing defaults options globally

You can, for example, disable the scrolling globally by using $.validationEngine.defaults.scroll = false.

This need to be added before the initialization, one good way to handle this would be to add your settings in a file.

<script src="js/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jquery.validationEngine-settings.js" type="text/javascript" charset="utf-8"></script>

Using the validationEngine with modal & dialog plugins

You can have more information about implementing the engine with modal views here: [http://www.position-absolute.com/articles/using-the-jquery-validation-engine-with-modal-plugins/]

Rules of thumb

  • field.id is unique across the page
  • From 2.2.4 and up, jquery 1.6+ is required because of prop()
  • for simplicity and consistency field.id and field.name should match (except with minCheckbox and maxCheckbox validators)
  • spaces or special chars should be avoided in field.id or field.name
  • use lower case for input.type ie. text, password, textarea, checkbox, radio
  • validators are evaluated from left to right, use the Ajax validator last e.g. validate[custom[onlyLetter],length[0,100],ajax[ajaxNameCall]]
  • please use only one Ajax validator per field!
  • JSON services should live on the same server (or you will get into browser security issues)
  • in a perfect RESTful world, http GET is used to READ data, http POST is used to WRITE data: which translates into -> Ajax validations should use GET, the actual form post should use a POST request.

Contribution

Contributions are always welcome, please follow these steps to submit your changes:

  1. Install git from http://git-scm.com/

  2. Create a github account on https://github.com

  3. Set up your git ssh key using these instructions http://help.github.com/set-up-git-redirect

  4. Open the jQuery Validation Engine project home page on github on https://github.com/posabsolute/jQuery-Validation-Engine

  5. Click the "Fork" button, this will get you to a new page: your own copy of the code.

  6. Copy the SSH URL at the top of the page and clone the repository on your local machine

    git clone [email protected]:your-username/jQuery-Validation-Engine.git my-jqv-repo
  7. Create a branch and switch to it

    cd my-jqv-repo
    git branch mynewfeature-patch
    git checkout mynewfeature-patch
  8. Apply your changes, then commit using a meaningful comment, that's the comment everybody will see!

    git add .
    git commit -m "Fixing issue 157, blablabla"
  9. Push the changes back to github (under a different branch, here myfeature-patch)

    git push origin mynewfeature-patch
  10. Open your forked repository on github at https://github.com/your-username/jQuery-Validation-Engine

  11. Click "Switch Branches" and select your branch (mynewfeature-patch)

  12. Click "Pull Request"

  13. Submit your pull request to JQV Developers

Support

We offer limited support on http://www.stackoverflow.com/

Use the tag jQuery-Validation-Engine

License

Licensed under the MIT License

Authors

Copyright(c) 2011 Cedric Dugas http://www.position-absolute.com

v2.0 Rewrite by Olivier Refalo http://www.crionics.com

jquery-validation-engine's People

Contributors

amuniz avatar angelk avatar bigmad avatar bux666 avatar bygiro avatar clemrz avatar dennybrandes avatar donmax avatar everplays avatar fulopattila122 avatar gomfunkel avatar gurskyi avatar harobed avatar hectorh30 avatar htshin avatar krasu avatar mecik avatar mingliangfeng avatar owenallenaz avatar pavlo-sof avatar posabsolute avatar reyo avatar rhafner avatar samjbarney avatar stephnr avatar tfevens avatar thomaspierson avatar tinny77 avatar u01jmg3 avatar vassilis-karapatakis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jquery-validation-engine's Issues

Remove full form ajax function

It was a nice idea, but it turns out, it is not really customizable, and really easy to repoduce using the success function

Closure.js in current download does not have working 'validateField'

I downloaded the zip, uploaded the files to server, and tested code. After failing several times with the .closure.js I tried the source. It worked fine. I ran the closure compiler on the source and it compiled to nearly 1k larger, but worked fully. Just thought I would let you know.

Code that was failing was:
var valid_city = $("#theForm").validationEngine('validateField', "#City");

Jquery UI

Hi,

I'm using jquery ui to have custom select drop down menu. My select drop down is required but nothing happen when you don't select anything. But all popups work fine on the rest of the form.

What I need to do to make it work?

Regards

making inline validation usable on submit

So I get the inline ajax validation - it's fairly straightforward. But it all falls apart when you start clicking submit. Without any ajax at all, submit does NOT submit the form if there are validation errors. However, submit ignores ajax validation errors and continues to submit the form. That is, unless ajaxFormValidation is set to true, in which case it insists on using form.action to validate the entire form, rather than ajax-validating each individual field and then submitting the form if they all pass.

If anyone has a workaround that lets me make the submit button "do the right thing" WITHOUT ajaxFormValidation turned on, I'd LOVE to hear it.

This tool is absolutely outstanding until you try to use the ajax functionality, in which case you proceed to pull out all of your hair.

AjaxFieldValidation - display server response

I wanted to be able to output a server message like it is possible with AjaxFormValidation.

Here's the updated code (lines 808ff). Working with response ["id", boolean,"message"]. If message is not set alertText resp alertTextOk is used:

if (errorField.length == 1) {
var status = json[1];
// Display message from server!
var msg = json[2];
if (!status) {
// Houston we got a problem
options.ajaxValidCache[errorFieldId] = false;
options.isError = true;
// Server Message
if (msg) var promptText = msg;
else var promptText = rule.alertText;
methods._showPrompt(errorField, promptText, "", true, options);
} else {
if (options.ajaxValidCache[errorFieldId] !== undefined)
options.ajaxValidCache[errorFieldId] = true;
// see if we should display a green prompt
// Server Message
if (msg) var alertTextOk = msg;
else var alertTextOk = rule.alertTextOk;
if (alertTextOk)
methods._showPrompt(errorField, alertTextOk, "pass", true, options);
else
methods._closePrompt(errorField);
}
}

Incorrect regex

I'm not sure why this is working, but the regex for email in jquery.validationEngine-en.js appears to be incorrect.

Currently it is /^[a-zA-Z0-9_\.\-]+\@([a-zA-Z0-9\-]+\.)+\.[a-zA-Z0-9]{2,4}$/

I think it should be /^[a-zA-Z0-9_\.\-]+\@([a-zA-Z0-9\-]+\.)+[a-zA-Z0-9]{2,4}$/

Not sure why, but this regex still passes an email address in the validation engine. However I cannot get it to pass in something like this:

document.write('[email protected]'.match(/^[a-zA-Z0-9_\.\-]+\@([a-zA-Z0-9\-]+\.)+\.[a-zA-Z0-9]{2,4}$/));

PS. Thanks for the great script.

Form validation should NOT use form.action

Re-working my web framework to identify ajax form validation mode and spit out JSON instead of the normal web template it usually produces is far from trivial.

There should be an init option that works similarly to validate[ajax[ajaxUserCallPhp]] and allows me to specify an alternate ajax URL to validate the whole form with.

custom Custom validators on check box

Attempted to add another validator to check box, instead of showing "required" text, I would like it to show something like "Must agree to terms & conditions" So I went to a validationEngine-en.js added this

"terms": { // Add your regex rules here, you can take telephone as an example
"regex": "none",
"alertTextCheckboxe": "* You must agree to terms & conditions"
},

Then attempted to use it as validate[required,custom[terms]] and it simply ignores my custom message and goes with * Required from the "required" definition.

I had to stick my custom text in the "required" area to get it to work. Now all check boxes are asking for "You must agree"

Also, it would be great if this plugin supported grouping of variables. Here is a post that does so with the jQuery built-in functionality. Would be wonderful if this can be applied to this plugin>

http://encosia.com/2009/11/04/using-jquery-validation-with-asp-net-webforms/

Great work by the way, thank you for sharing and putting your hours into it.

Multiple custom function rules bug

When using multiple function rules (as in validateCustom1() & validateCUstom2() at the same time, if one is false the otehr do not pass

Trouble with using AJAX

Hi,
firstly I tell you that the AjaxValidator is exellent, but only one thing and that problem is to use Ajax. I know used to ajax by jQuery alone, but here I don't know, how to make it work.
I try use demo by http and local, but it's not working.
Local write: 'Please run this demo from a WebServer (ie. http://localhost:9173/demoAjax.html after running the demo server), it will fail if you double click demoAjax.html -> It needs a server.'

I read manual and answers to report of problem, but still I don't know, how to make it work.

Could you help me, should provide an illustrative example of how it really works in the itemized step by step, especially what to write in "ajaxUserCall" (url, etc.) in jquery.validationEngine-xx.js, what is in action="ajaxSubmitForm" etc.
Working demo is not necessary, but just write the specific parameters of functioning Ajax somewhere, I can understand it from that. I don't understand the instructions.
Thank you very much.
Houbeless

Prompts append to body, not target

As such, if you have a fixed position overlay with a scrollable background, your prompts will scroll away from the form with the background.

asp.net and validation group

Hi,

ASP.NET webpages uses a default form element. I tried to add another one inside the other form element but then the script does not work.

How can I use your plugin without form elements?

Can elements not be grouped together as it goes with asp.net validators? Then you don't need the form element and can be very flexible.

Thanks!

Request - Ignore required

I've found a situation that may be generic enough for this scenario be part of the API.
I'm working in a huge multiplart form, that is made of lot's of different div's that I show or hide.
I then have a Save and Submit button. The Save enables me to save the fields that I have inserted values, and I can do this at any time. In this case I only want to validate the content of the fields ( regex expressions ) and not all fields of the form that are required.
In case I hit the submit button, I want to make sure that all content is valid but that all required fields of the form have data. So, it would be nice to call the validation and have a boolean to ignore the required ( default to false ).

when using ajax validation normal prompts don't show

Hello, I stumbled upon the really annoying error of not showing the error prompt when I tried using custom regex validation rules together with a custom ajax validation.
I managed to resolve the bug, by changing the following lines:

 if (!isAjaxValidator) {
     if (options.isError)
         methods._showPrompt(field, promptText, "", false, options);
     else
         methods._closePrompt(field);
 }

to the following:

 if (options.isError)
     methods._showPrompt(field, promptText, "", false, options);
 else if (!isAjaxValidator) {
     methods._closePrompt(field);
 }

It looks like everything is working fine now, although it might be better to give it another look.
Thank you for the great plugin,

kind regards
Lukas

Passing more than ONE parameters for Ajax validation

Hi

Do you know how to pass more than one parameters for Ajax validation?

Eg. If I want to check whether the username is being used, the Ajax magic will read the username and pass it to the Ajax method. Can I pass more than ONE parameters?

Thanks

Cheers,

Wil

Multiple ajax crash the plugin

Well first of all thanks for this grate tool, but i have this issue:

I have my Index.html, that have a section that will be replaced with my indexContent.html on the onload event of the body, then, my indexContent.html uses the jQuery-Validation-Engine, but it does not show the bubble errors :-( I have tried import the js's and css's from both, mi index.html, and my indexContent.html with no success.

Here is the indexContet.html working fine http://vitasoft.no-ip.org/SINDESY/indexContent.html

but when i call it winth ajax in the index.html just fails: http://vitasoft.no-ip.org/SINDESY/

My regards. :-)

problem with element id containing colon(:) in Chrome

Frameworks like JSF construct HTML element names by separating the id element with a colon character, e. g. myForm:nameInput. Attaching a validation prompt to this HTML element fails in Chrome when constructing and using a className:

var className = "." + field.attr("id") + "formError"; (line 980)

A similar effect exists in function hidePrompt.

disable submit button

is there a built in way or a way to add a feature so that if the form is successfully validated, the submit button is disabled, restricting duplicate entries?

prompt dissapear on second submit with ajaxFormValidation = true

Hi,

fighting some hours with that. I am using jQuery 1.5 together with your lib. I created a login form where the login is validated on submit via AJAX. This works ok for the first time. The prompt appears and everything is fine. Now i hit submit again (still with wrong credentials) and even though the AJAX response sent an error, the prompt goes away.

I debugged this monster for some hours. The point is, the DIV gets removed somehow. I made the following dirty hack:

    _showPrompt: function(field, promptText, type, ajaxed, options) {
        var prompt = methods._getPrompt(field);
        if (prompt) {
            //methods._updatePrompt(field, prompt, promptText, type, ajaxed, options)
            methods._buildPrompt(field, promptText, type, ajaxed, options);
        }
        else {
            methods._buildPrompt(field, promptText, type, ajaxed, options);
        }
    },

see the updatePrompt() which i commented out and replaced with _buildPrompt(). This way all works but its not intented how it should work. But it gets stranger. If i am in debug mode, i dont get this behavior. As soon as i try to debug it, everything works fine. Without debugging, i am getting this issue. I know, this sounds strange.

I am afraid that this might be non-reproducable for others but perhaps its worth a try.

Marc

some callbacks fuctions would be nice

like:
$form.validationEngine('onError', function(event, formElement){})
$form.validationEngine('onResolved', function(event, formElement){})

or functions to show prompt on all invalid fields

 $form.validationEngine('showAllErrors');

those function become handy if you have a form field which is spitted in diffenrent jquery tabs.
if i change the tab i want the prompt dissapear

$form.validationEngine('hide');

but i want to add a class to the tab to indicate an error in this tab.

$form.tabs({
  select: function(event, ui) { 
    $form.validationEngine('hide');
    $form.validationEngine('hasErrors?', function(){
       $(ui.item).addClass('has_error');
    });
  }
});

well kind of, need the correct tab of course, but you get the point :)

ps. great plugin by the way. like it !

ie9 odd issue

i am having an issue with ie9 to where the validation is inline is active if form has been submitted once.

FuncCALL + custom[number]

Hi,
I want to ask you, if it's possible to merge two types of validation.
I use funcCall: At least one field is required, and I would need, in addition to this function was applied other features to individual fields, in my case: custom[number].
Can this be done?
Thanks for help

Optional - not working

I have a text box that is using a regex pattern and is marked optional, however if I try to either tab through the field or if I try to submit the form without ever entering the field then the error is shown and the form will not submit.

showPrompt ignores promptPosition

No matter what I put, it uses it in the default position instead.

$('#divAgree2').validationEngine('showPrompt', '* This checkbox is required', 'checkbox', 'bottomRight', true);

when using jQuery.noConflict with translation files

When using others JS framework, we usually use jQuery.noConflict. Howver, translation files don't take care of that on the last lines of them :

$(document).ready(function() {  
    $.validationEngineLanguage.newLang();
});

Instead of that, this block should be rewrite to take care of the noConflict use and the fact that we can't use "$" without protected mode to prevent this block to generate errors.

Proposed modifications to date regex

Date regex customization provided with stock version of ValidationEngine allows to incorrectly switch month and dayand dates like 2011-99-99.

I would like to propose a modification to the date customization regex from:

   "regex": /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, 

to:

   "regex": /^\d{4}[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, 

or if you want to restrict to 20th and 21st centuries:

   "regex": /^((19|20)\d\d)[\/\-](0?[1-9]|1[012])[\/\-](0?[1-9]|[12][0-9]|3[01])$/, 

Best regards
Mariano

onValidationComplete is missing its associated function? (used to be onSuccess)

I'm not sure if I'm understanding the code correctly but I believe the option onValidationComplete is missing its associated function? I have an ajax based form I'd like to submit once validation has been successfully performed by validationEngine. There used to be an onSuccess function but it is no longer there.

I've added the code snippet below to re-enable this.

onValidationComplete: false,
// John Carbajal
// function associated with onValidationComplete
validationComplete: $.noop,

_onSubmitEvent:
...
if(options.onValidationComplete) {
// John Carbajal
// ensure the validationComplete function is defined
if (options.validationComplete == $.noop)
{
$.error('options.onValidationComplete is true but options.validationComplete is null');
return false;
}
else
{
options.validationComplete(form, r);
return false;
}
}

IPv4 regular expression fix

Hi, I'm looking into your source and see that your regular expression for IPv4 recognition can be improved. As it looks today, an IP like 999.999.999.999 is allowed -- which it shouldn't. A better pattern for IP matching is;

^\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?).(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b$

I would like do something like : user need to fill field1 or/and field2 ?

Hi,

I would like do something like :

  • user need to fill field1 or/and field2

I try do this mechanism with "funcCall" type but there are this instruction in "_validateField" method :

if(!required){
    if(field.val() == "") options.isError = false;
}

How can I implement this feature ?

I work on source code to suggest an solution.

Regards,
Stephane

_past _future _parseDate have errors

This is regarding version 2.1
The _past and _future rule are swapped with regards to the error message. The following two line changes should fix it to reflect the validation error messages.

line 693 is:
if (vdate > pdate ) {
it should be
if (vdate < pdate ) {

line 715 is:
if (vdate < pdate ) {
it should be:
if (vdate > pdate ) {

The _parseDate function improperly checks the relationship between dateParts and d.split('-').

line 860 is:
if(dateParts!==d)
it should be:
if(dateParts==d)

Bug - Bubble position after Hide

After calling $('#formID1').validationEngine('hide') or $('#formID1').validationEngine('hideAll') the bubles loose seem to get the default position (topLeft) even if we changed that on setup to other position (topRight).

remote Ajax validation

since the update to version 2.0 our ajax[selector] function were using to connect to our database to validate the users email and user name has not been working, forced to use version 1.7 still

Please separate the translations from the validations

Idea: create some I18N inner class with method text(key) that returns a translated text if it loaded, else the default english text (always loaded).

It's going to become difficult to maintain as the number of translations increase with time otherwise.

Optional fields still get validated

If field is not required, the engine shall skip validations.

I know how to fix this one, need to check for empty string before each validations.

UK Postcode

I have added the following and I thought it may be useful enough to other people to pass along

"postcode": {
"regex": /^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9]?[ABEHMNPRVWXY0-9]? {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/,
"alertText": "* Invalid postcode"
},

Dutch (nl) translation

(function($){
$.fn.validationEngineLanguage = function(){
};
$.validationEngineLanguage = {
newLang: function(){
$.validationEngineLanguage.allRules = {
"required": { // Add your regex rules here, you can take telephone as an example
"regex": "geen",
"alertText": "* Dit veld is verplicht",
"alertTextCheckboxMultiple": "* Selecteer a.u.b. een optie",
"alertTextCheckboxe": "* Dit selectievakje is verplicht"
},
"minSize": {
"regex": "none",
"alertText": "* Minimaal ",
"alertText2": " karakters toegestaan"
},
"maxSize": {
"regex": "none",
"alertText": "* Maximaal ",
"alertText2": " karakters toegestaan"
},
"min": {
"regex": "none",
"alertText": "* Minimale waarde is "
},
"max": {
"regex": "none",
"alertText": "* Maximale waarde is "
},
"past": {
"regex": "none",
"alertText": "* Datum voorafgaand aan "
},
"future": {
"regex": "none",
"alertText": "* Datum na "
},
"maxCheckbox": {
"regex": "none",
"alertText": "* Toegestane aantal vinkjes overschreden"
},
"minCheckbox": {
"regex": "none",
"alertText": "* Selecteer a.u.b. ",
"alertText2": " opties"
},
"equals": {
"regex": "none",
"alertText": "* Velden komen niet overeen"
},
"phone": {
// credit: jquery.h5validate.js / orefalo
"regex": /^([+][0-9]{1,3}[ .-])?([(]{1}[0-9]{2,6}[)])?([0-9 .-/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/,
"alertText": "* Ongeldig telefoonnummer"
},
"email": {
// Simplified, was not working in the Iphone browser
"regex": /^([A-Za-z0-9_-.'])+@([A-Za-z0-9_-.])+.([A-Za-z]{2,6})$/,
"alertText": "* Ongeldig e-mailadres"
},
"integer": {
"regex": /^[-+]?\d+$/,
"alertText": "* Ongeldig geheel getal"
},
"number": {
// Number, including positive, negative, and floating decimal. credit: orefalo
"regex": /^[-+]?(([0-9]+)(.,)?|(.,)?)$/,
"alertText": "* Ongeldig drijvende comma getal"
},
"date": {
// Date in ISO format. Credit: bassistance
"regex": /^\d{4}[/-]\d{1,2}[/-]\d{1,2}$/,
"alertText": "* Ongeldige datum, formaat moet JJJJ-MM-DD zijn"
},
"ipv4": {
"regex": /^([1-9][0-9]{0,2})+.([1-9][0-9]{0,2})+.([1-9][0-9]{0,2})+.([1-9][0-9]{0,2})+$/,
"alertText": "* Ongeldig IP-adres"
},
"url": {
"regex": /^(https?|ftp)://(((([a-z]|\d|-|.||~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!$&'()+,;=]|:)@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]).(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]).(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]).(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|.|||[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))).)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|.|||[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))).?)(:\d)?)(/((([a-z]|\d|-|.||~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!$&'()_+,;=]|:|@)+(/(([a-z]|\d|-|.|||[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!$&'()*+,;=]|:|@)))?)?(?((([a-z]|\d|-|.|_||[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!$&'()*+,;=]|:|@)|[\uE000-\uF8FF]|/|?))?(#((([a-z]|\d|-|.||~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!$&'()_+,;=]|:|@)|/|?))?$/,
"alertText": "
Ongeldige URL"
},
"onlyNumberSp": {
"regex": /^[0-9\ ]+$/,
"alertText": "* Alleen cijfers"
},
"onlyLetterSp": {
"regex": /^[a-zA-Z\ ']+$/,
"alertText": "* Alleen leestekens"
},
"onlyLetterNumber": {
"regex": /^[0-9a-zA-Z]+$/,
"alertText": "* Geen vreemde tekens toegestaan"
},
// --- CUSTOM RULES -- Those are specific to the demos, they can be removed or changed to your likings
"ajaxUserCall": {
"url": "ajaxValidateFieldUser",
// you may want to pass extra data on the ajax call
"extraData": "name=eric",
"alertText": "* Deze gebruiker bestaat al",
"alertTextLoad": "* Bezig met valideren, even geduld aub"
},
"ajaxNameCall": {
// remote json service location
"url": "ajaxValidateFieldName",
// error
"alertText": "* Deze naam bestaat al",
// if you provide an "alertTextOk", it will show as a green prompt when the field validates
"alertTextOk": "* Deze naam is beschikbaar",
// speaks by itself
"alertTextLoad": "* Bezig met valideren, even geduld aub"
},
"validate2fields": {
"alertText": "* Voer aub HELLO in"
}
};

    }
};
$.validationEngineLanguage.newLang();

})(jQuery);

Ajax not working

Hi,

I have just realized your Ajax sample (from the latest download) doesn't work (demoAjax.html). I'm trying to validate an email address whether it has already registered in the system.

in jquery.validationEngine-en.js file added the following ....................

"ajaxUserCall": {
"url": "http://localhost:8080/iicube/validateUserAjax",
"alertText": "* This email address has been registered",
"alertTextOk": "* This email address is available",
"alertTextLoad": "* Validating, please wait"
},

in html file added the following ......................

<script type="text/javascript"> jQuery(document).ready(function(){ jQuery("#formID").validationEngine({ ajaxFormValidation: true }); jQuery("#formID").validationEngine('attach'); }); </script>

For some reason, http://localhost:8080/iicube/validateUserAjax is not being triggered. Any thought on this?

Cheers,

Wilkins

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.