From b756bb52fe378fc95fb05b3a454aadb00ae12dcf Mon Sep 17 00:00:00 2001 From: jlukic Date: Tue, 14 Jul 2015 17:15:33 -0400 Subject: [PATCH] #2629 Throw error when identifier is a non-string value --- RELEASE-NOTES.md | 1 + src/definitions/behaviors/form.js | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 84d266a47..2b94995ff 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -11,6 +11,7 @@ - **Segment* - `horizontal segments` in IE will no longer stretch to the natural width of child imgs #2550 [flexbug #1](https://github.com/philipwalton/flexbugs#1-minimum-content-sizing-of-flex-items-not-honored) - **Sticky** - Fixed `sticky` element that cannot fit in viewport not scrolling correctly when fixed to viewport #2605 - **Form** - Fixed issue with `minLength[1]` validation not behaving same as `minLength > 2` #2636. +- **Form** - Form fields will now error when a non-string identifier is used **Additional Bugs** - **Popup** - `wide` and `very wide` popup will now limit themselves to normal popup widths on mobile so that they still appear on screen. diff --git a/src/definitions/behaviors/form.js b/src/definitions/behaviors/form.js index 433507f1c..2b413a597 100644 --- a/src/definitions/behaviors/form.js +++ b/src/definitions/behaviors/form.js @@ -495,6 +495,9 @@ $.fn.form = function(parameters) { field: function(identifier) { module.verbose('Checking for existence of a field with identifier', identifier); + if(typeof identifier !== 'string') { + module.error(error.identifier, identifier); + } if( $field.filter('#' + identifier).length > 0 ) { return true; } @@ -1017,9 +1020,10 @@ $.fn.form.settings = { }, error: { - oldSyntax : 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.', - noRule : 'There is no rule matching the one you specified', - method : 'The method you called is not defined.' + oldSyntax : 'Starting in 2.0 forms now only take a single settings object. Validation settings converted to new syntax automatically.', + identifier : 'You must specify a string identifier for each field', + noRule : 'There is no rule matching the one you specified', + method : 'The method you called is not defined.' }, templates: {