Skip to content

add validator checkbox_group, plus utility for numeric range #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 26, 2013

Conversation

stevewasiura
Copy link
Contributor

checkbox_group
added validator to check a group of checkboxes, to ensure required number of checkboxes were checked, using range (1-2), min1, or max2, etc.

lang
added prefix & suffixes for checkbox_group
renamed prefixes & suffixes used for length validation

numericRangeCheck
added utility function to evaluate value against allowed parameter. abstracted internal check in validate_length to use this util function instead of repeating functionality

validate_length
edited function to use new utility function numericRangeCheck

checkbox_group
added validator to check a group of checkboxes, to ensure required number of checkboxes were checked, using range (1-2), min1, or max2, etc.

lang
added prefix & suffixes for checkbox_group
renamed prefixes & suffixes used for length validation

numericRangeCheck 
added utility function to evaluate value against allowed parameter. abstracted internal check in validate_length to use this util function instead of repeating functionality

vaildate_length
edited function to use new utility function numericRangeCheck
for validator checkbox groups
and variable name changes
jQ selector of form inputs for onBlur, only select input that have attribute "data-validation", this skips form elements with no validation, including submits, buttons, and reset

i was going crazy debugging this when every function was named validate, dovalidate, validateInput, etc. 
so i renamed them based on what they did.
thanks
numericRangeCheck had bug in conditional structure; fixed.

checkbox_group had bug when checking checkboxes in same group.
added special test in validateInput() function, to force element to be first input element in group, so error msg only output once. also changed .append back to .text to support this case.
@stevewasiura
Copy link
Contributor Author

sorry for this, it's a lot of changes to review

@victorjonsson
Copy link
Owner

I have looked through the code, great work! I agree on all changes except validatorLoad. We have other functions (like $.formUtils.loadModules and onModulesLoaded) where the word load means that something is fetched from the server. I would therefor prefer not to use the word load in this function.

I will merge this pull anyway but I will not release a new version until we have come to a comfortable solution regarding the function name. What about simply $.formValidation()

$.formValidation({
    form : '#registation-form',
    modules : 'security, location'
});

victorjonsson added a commit that referenced this pull request Jul 26, 2013
add validator checkbox_group, plus utility for numeric range
@victorjonsson victorjonsson merged commit db4ea23 into victorjonsson:master Jul 26, 2013
@stevewasiura
Copy link
Contributor Author

yeah thanks. i was hoping you didn't mind the change in most function names.

i'm still not sure about the main function name. i guess i want something that indicates it is being setup, loaded, configuring, etc. since the actual validation process occurs either on submit on onblur.

how about
"validationSetup" ?

@stevewasiura stevewasiura deleted the patch-10 branch July 26, 2013 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants