Validation for editableList

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
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

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.

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.

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

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.

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?

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