1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Numeric validator that accepts blank should accept undefined

This commit is contained in:
Nick O'Leary 2017-01-25 16:11:56 +00:00
parent ddb2ea4b5f
commit 4affbb8c6b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
**/ **/
RED.validators = { RED.validators = {
number: function(blankAllowed){return function(v) { return (blankAllowed&&v==='') || (v!=='' && !isNaN(v));}}, number: function(blankAllowed){return function(v) { return (blankAllowed&&(v===''||v===undefined)) || (v!=='' && !isNaN(v));}},
regex: function(re){return function(v) { return re.test(v);}}, regex: function(re){return function(v) { return re.test(v);}},
typedInput: function(ptypeName,isConfig) { return function(v) { typedInput: function(ptypeName,isConfig) { return function(v) {
var ptype = $("#node-"+(isConfig?"config-":"")+"input-"+ptypeName).val() || this[ptypeName]; var ptype = $("#node-"+(isConfig?"config-":"")+"input-"+ptypeName).val() || this[ptypeName];