diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 3cffd65b6..46ba4a7ab 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -39,6 +39,7 @@ - **Dropdown** - Added `showOnFocus` option - **Form** - Added placeholder color rules for IE, `ms-input-placeholder` - **Form** - Fix `errored field` dropdown keyboard selection color +- **Form Validation** - `data-validate` now takes precedence over other validation matching schemes like `name` or `id` - **Form Validation** - Form validation now has `minCount`, `maxCount`, and `exactCount` for validating multiple selections - **Grid** - `celled grid` now removes internal cells on mobile and tablet when used with `doubling` grid responsive variation - **Grid** - `equal width` now works without `row` wrappers diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js index 7fa4df42c..4826cba83 100644 --- a/src/definitions/behaviors/form.js +++ b/src/definitions/behaviors/form.js @@ -1115,15 +1115,15 @@ $.fn.form.settings = { $form = $(this), matchingValue ; - if($form.find('#' + fieldIdentifier).length > 0) { + if( $form.find('[data-validate="'+ fieldIdentifier +'"]').length > 0 ) { + matchingValue = $form.find('[data-validate="'+ fieldIdentifier +'"]').val(); + } + else if($form.find('#' + fieldIdentifier).length > 0) { matchingValue = $form.find('#' + fieldIdentifier).val(); } else if($form.find('[name="' + fieldIdentifier +'"]').length > 0) { matchingValue = $form.find('[name="' + fieldIdentifier + '"]').val(); } - else if( $form.find('[data-validate="'+ fieldIdentifier +'"]').length > 0 ) { - matchingValue = $form.find('[data-validate="'+ fieldIdentifier +'"]').val(); - } return (matchingValue !== undefined) ? ( value.toString() == matchingValue.toString() ) : false