This is an old revision of the document!


Javascript plugins

formvalidation.io

http://formvalidation.io/

  • Notes
    • Field is not validated when value is changed programmatically: validate manually with revalidateField method.
    • Form is not reset if not visible: this causes issues with hidden modal
    • If validation added with HTML5 data-attributes, add additional validation with 'addField'.
      • Example:
        $('#modalForm-2').formValidation('addField', 'hotel_checkin', {
        	validators: {
        		remote: {
        			url:'/ajax/getdata.php',
        			data: function(validator, $field, value) {
        				// validator is FormValidation instance, $field is the field element, value is the field value
        				// Return an object
        				return {
        					hotel_checkout: $('input[name="hotel_checkout"]').val(),
        					request: 'validate_hoteldates'
        				}
        			}
        		}
        	}
        });
    • Date
      • is only checked if type="date" or data-fv-date="true"
      • default format = MM/DD/YYYY, use data-fv-date-format="YYYY-MM-DD"
      • min= and max= is not supported (use data-fv-date-min= and data-fv-date-max=)
  • Issues