From 909fa9441fb914a4e8c4aa6994ed79809f76292b Mon Sep 17 00:00:00 2001 From: Craig Davis Date: Sat, 22 Jan 2011 20:21:09 -0600 Subject: [PATCH] Adding initial documentation for validation system --- VALIDATION.md | 62 ++++++++++++++++++++++++++++++++ js/uni-form-validation.jquery.js | 4 +-- 2 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 VALIDATION.md diff --git a/VALIDATION.md b/VALIDATION.md new file mode 100644 index 0000000..1e9d561 --- /dev/null +++ b/VALIDATION.md @@ -0,0 +1,62 @@ +# [Uni-Form Markup](http://sprawsm.com/uni-form/) : Validation documentation + + +## Initialize the jQuery plugin + +The following code will initialize the jQuery Validation plugin with the default options. + + + + + +You may use a global object to hold site wide validation settings. To do this, you should +copy the jQuery.fn.uniform.defaults = {} object from the bottom of the validation javascript +file into a new file that you use throughout your site. You may then edit options there +globally, and will make the Uni-Form library easy to update in the future. + +You may also initialize Uni-Form Validation with custom settings by passing a settings object +as a parameter when you call uniform(). + + + +## Uni-Form Settings + + +* prevent_submit (false) + Set this to true to prevent the form from submitting if there are outstanding + errors in the form +* prevent_submit_callback (false) + Supply a function here and it will be called instead of the internal handler. + This function can return true to allow the form to proceed with the commit +* ask_on_leave (false) + Set this to true to have the browser prompt if the visitor has made changes to + the form, and then initialized a page unload without submitting the form +* on_leave_callback (false) + Provide a function and it will be called instead of the internal method +* valid_class ('valid') + CSS class name used for div.holder_class elements that have passed validation +* invalid_class ('invalid') + CSS class name used for div.holder_class elements that have failed validation +* error_class ('error') + Please note that both of these are applied by the validation script. + You may wish to set them separately at the server perhaps. +* focused_class ('focused') + CSS class name applied to the .holder_class of the current element +* holder_class ('ctrlHolder') + CSS class name that you have used as the control holder class +* field_selector ('input, textarea, select') + List of html elements that will be treated with Uni-Form highlighting and + validation (if enabled) +* default_value_color ("#AFAFAF") + HEX color used to display the default data in the background of empty text inputs \ No newline at end of file diff --git a/js/uni-form-validation.jquery.js b/js/uni-form-validation.jquery.js index c5aa801..08cc1f0 100644 --- a/js/uni-form-validation.jquery.js +++ b/js/uni-form-validation.jquery.js @@ -651,7 +651,7 @@ jQuery.fn.uniform = function(extended_settings) { }); /** - * Handle a succesfull validation in the form element + * Handle a succesful validation in the form element * * Remove any error messages and set the validation * marker to be success @@ -694,7 +694,7 @@ jQuery.fn.uniform.language = { }; /** - * prevent_submit : enable with either true or class on form of "preventSubmit" + * See the validation.md file for more information about these options */ jQuery.fn.uniform.defaults = { prevent_submit : false,