Browse Source

Data-validate takes precedence on matching

pull/2169/head
jlukic 9 years ago
parent
commit
d48a9f01a0
2 changed files with 5 additions and 4 deletions
  1. 1
      RELEASE-NOTES.md
  2. 8
      src/definitions/behaviors/form.js

1
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

8
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

Loading…
Cancel
Save