# Validation for editableList

**URL:** <https://discourse.nodered.org/t/validation-for-editablelist/21055>\
**Category:** Developing Nodes\
**Created:** [30 January 2020 19:58 UTC](https://discourse.nodered.org/t/validation-for-editablelist/21055 "2020-01-30T19:58:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [30 January 2020 19:58 UTC](https://discourse.nodered.org/t/validation-for-editablelist/21055/1 "2020-01-30T19:58:42Z")

</div>

Developing the ui-state-trail I fell into little problem.  
typedInput items individually can be validated. But if all items are valid but collection of rules gathered from individual items has to be validated (like all items must have one required parameter configured unique), there will be no item to blame. How to indicate source of error (red frame)?  
I figured out some kind of solution, but it is far from perfect.

Today I found issue against core nodes [https://github.com/node-red/node-red/issues/2433](https://github.com/node-red/node-red/issues/2433)  
Source of problem from same area but little different outcome.

So my question is, can/should the editableList have validation method(s)

- against all items must be valid
- count of items/rules must be configured (just an idea from my experiences)
- there may be more

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [30 January 2020 20:14 UTC](https://discourse.nodered.org/t/validation-for-editablelist/21055/2 "2020-01-30T20:14:59Z")

</div>

There is a deeper issue here related to how nodes are validated.

You have to remember the node needs to be validated _without_ its edit dialog open. So the issues in #2433 are related to the fact the Change node uses the TypedInput validation when the edit dialog is open, but when the dialog is closed, the editor doesn't what is valid for the node.

> [@hotNipi](#):
>
> So my question is, can/should the editableList have validation method(s)
> 
> - against all items must be valid
> - count of items/rules must be configured (just an idea from my experiences)
> - there may be more

The items in an editableList can be any html. There is no concept of whether an item is valid or not. The fact an item may contain a TypedInput that is or isn't valid is not something the list knows about.

So this would need some new mechanism adding to both editableList and TypedInput to allow the validation to be passed between them. If you wanted to proposed a something specific for this, then please go ahead.

Not sure what the "count of items/rules" comment means.

But you must also remember, as per my initial comment, that the node still needs to be able to validate its properties without any reference to the UI components the edit dialog uses.

Let me know if you want to propose a specific set of changes to the widgets. Otherwise I'll put it on the backlog for the future.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [30 January 2020 20:36 UTC](https://discourse.nodered.org/t/validation-for-editablelist/21055/3 "2020-01-30T20:36:50Z")

</div>

> [@knolleary](#):
>
> Not sure what the "count of items/rules" comment means.

From ui-state-trail node configuration, the user must configure at least 2 states. Rules are removable.

> [@knolleary](#):
>
> The items in an editableList can be any html

That's what I was a little afraid of and probably will be the main obstacle to figure out some easy solution.

But ok, I think about it a little more but for a moment no bright ideas.

---

<div class="post-metadata">

**Author:** ![hotNipi](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hotnipi/32/383_2.png) [@hotNipi](https://discourse.nodered.org/u/hotNipi)\
**Post date:** [5 March 2020 19:33 UTC](https://discourse.nodered.org/t/validation-for-editablelist/21055/4 "2020-03-05T19:33:54Z")

</div>

Another try to use the `editabeleList` to create smooth and user friendly configuring, lead me to next question on this topic.

The `removable` is parameter of `editableList`, which affects all items in it.  
If node have set of rules where certain rules are required and other are optional, then It would be nice if required rules can't be removed, but only edited.

Does it seem logical and is it possible to do something about it?  
Or is there some other possible tricks to prevent some items to be removed?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 May 2020 19:34 UTC](https://discourse.nodered.org/t/validation-for-editablelist/21055/5 "2020-05-04T19:34:00Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
