[Proposal] Add validation tooltip message to ALL fields

Hi team,

When an input is invalid, the field turns red but we can go further... Only certain entries have a tooltip that appears to show the error to the user which is more practical than "invalid field".

Unfortunately, as I said, there are only a few entries that use it and I want to fix it.

There are two ways to trigger a tooltip:

  1. From node properties

Currently only inputs NOT builded with typedInput support tooltip.
I added support for inputs built with typedInput in #4449 and took the opportunity to add a tooltip to the field type (typeField) in #4450.

  1. From jQuery

All that's left is built-in jQuery support to use the tooltip in a container like the inject node.

Are you interested?

@knolleary, regarding backwards compatibility, I just have to be careful to return a boolean for .typedInput("validate") method?

Thank you all for your feedback :slightly_smiling_face:

Do those messages get pulled from the message catalogue ? I.E. are they i18n translatable ?

Yes, the principle of validation does not change, it is entirely possible to use i18n in the validate function.

For the default validation functions (e.g. msg) the node-red catalog will be used

I use this kind of function for my nodes:

1 Like

@knolleary, @dceejay,
To generate the tooltip there are two possibilities:

  1. In typedInput validate and the returned value is a boolean
  2. In validateNodeEditorProperty but the validate function (PR#4455) must return a string

The advantage of the second is that it's centralized, the disadvantage is for backward compatibility. What is the best approach?

Hi Team,
Made some progress on the tooltip validation message - Add tooltip input validation msg · GogoVega/node-red@ba08cf0 · GitHub

Last remaining is to translate the errors created by normalizePropertyExpression, how do we do it?

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