Skip to content

jQuery Form Validate Settings Object

vmichnowicz edited this page Feb 8, 2013 · 1 revision

Everything in jQuery Form Validate can be customized and configured through the modification of the settings object. This object can be modified on a both a global and local scope. Modifying a method or property on a global scope affects all form validation instances on the page. If you only need to modify some settings for an individual form then settings can be applied locally.

Global

Global modification of the settings object can be accomplished through $.extend()

jQuery.extend(true, jQuery.fn.formvalidate.options {
	preProcess: function() {
		// Do something cool...
	},
	onSuccess: function() {
		alert('Great success!');
	},
	inputFailureClass: 'epic-failz0rz'
});

Local

$('form').submit(function(e) {
	e.preventDefault();
	$(this).formvalidate({
		preProcess: function() {
			// Do something cool...
		},
		onSuccess: function() {
			alert('Great success!');
		},
		inputFailureClass: 'epic-failz0rz'
	});
});

Complete Object Reference (Hierarchy)

  • preProcess
  • postProcess
  • onSuccess
  • onFailure
  • messageParent
  • messageElement
  • failureMessages
  • successMessages
  • messageFailureClass
  • messageSuccessClass
  • inputFailureClass
  • inputSuccessClass
  • cssParamDelimiter
  • language
  • localization
    • en
      • success
        • default
        • betweenNumeric
        • date
        • email
        • numChars
        • minChars
        • maxChars
        • numOptions
        • minOptions
        • maxOptions
        • int
        • float
        • required
        • requiredIf
        • lessThan
        • greaterThan
      • failure
        • default
  • filters
    • trim
    • strtoupper
    • strtolower
  • validations
    • betweenNumeric
    • date
    • dateAfter
    • dateBefore
    • email
    • numChars
    • minChars
    • maxChars
    • numOptions
    • minOptions
    • maxOptions
    • int
    • float
    • required
    • requiredIf
    • lessThan
    • greaterThan

Clone this wiki locally