mirror of
				https://github.com/node-red/node-red.git
				synced 2025-03-01 10:36:34 +00:00 
			
		
		
		
	Merge pull request #4812 from GogoVega/fix-required-prop
Fix node validation if the property is not required
This commit is contained in:
		| @@ -157,6 +157,12 @@ RED.editor = (function() { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         if (valid && "validate" in definition[property]) { |         if (valid && "validate" in definition[property]) { | ||||||
|  |             if (definition[property].hasOwnProperty("required") && | ||||||
|  |                 definition[property].required === false) { | ||||||
|  |                 if (value === "") { | ||||||
|  |                     return true; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             try { |             try { | ||||||
|                 var opt = {}; |                 var opt = {}; | ||||||
|                 if (label) { |                 if (label) { | ||||||
| @@ -183,6 +189,11 @@ RED.editor = (function() { | |||||||
|                 }); |                 }); | ||||||
|             } |             } | ||||||
|         } else if (valid) { |         } else if (valid) { | ||||||
|  |             if (definition[property].hasOwnProperty("required") && definition[property].required === false) { | ||||||
|  |                 if (value === "") { | ||||||
|  |                     return true; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|             // If the validator is not provided in node property => Check if the input has a validator |             // If the validator is not provided in node property => Check if the input has a validator | ||||||
|             if ("category" in node._def) { |             if ("category" in node._def) { | ||||||
|                 const isConfig = node._def.category === "config"; |                 const isConfig = node._def.category === "config"; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user