jQuery Validate Plugin Formatting

/ Published in: jQuery
Save to your folder(s)

Copy this code and paste it in your HTML
  1. jQuery(function() {
  2. jQuery("#form_field").validate({
  3. rules: {
  4. bus_ent_id: "required", //only one method doesn't need brackets
  5. inv_in_transit: {required:true,number:true}, //multiple methods requires brackets
  6. outstanding_credits: {required:true,number:true},
  7. cores_on_hand: {required:true,number:true},
  8. warranty_part_on_hand: {required:true,number:true},
  9. comments: {maxlength:500},
  10. submitted_by: "required"
  11. },
  12. messages: {
  13. bus_ent_id: "You must choose your store from the drop down list.",
  14. inv_in_transit: "You must enter a valid Quantity Inventory in Transit amount. If none, please enter 0",
  15. outstanding_credits: "You must enter a valid Outstanding Credit amount. If none, please enter 0",
  16. cores_on_hand: "You must enter a valid Core on Hand amount. If none, please enter 0",
  17. warranty_part_on_hand: "You must enter a valid Warranty Part on Hand amount. If none, please enter 0",
  18. comments: "Must be under 500 characters in length",
  19. submitted_by: "This form is not complete. Submitted by is Empty! Please enter your name."
  20. }
  21. });
  22. });

URL: http://rocketsquared.com/wiki/Plugins/Validation#List_of_built-in_Validation_methods

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.