Input box validation failure

I've spotted an annoying problem with node-red-contrib-google-smarthome where the node config has two options, selectable via a tick box;

The first option is to use google authentication (preferred option)

google pass

The second option, by unticking the box, users can use a simple password

google local

The problem is that if the first option is selected (Google login), the second option's input boxes would be left blank (as we aren't using the second option).
But because they are blank, node-RED will not verify the input boxes, and as you can see in the screenshot above, node-RED colours the input box outlines red, places a red triangle on the node, and a popup saying that the node is not correctly configured (despite option 1 being selected).


However despite this annoyance, node-red-contrib-google-smarthome works very well :+1:

I've tried adding a input box placeholder for the fields, which didn't help, and have opened an issue with the author, but wondered if anyone knows the best way to deal with this pls?

the author would need to use a custom validator that takes into account if they are active or not.

I've been reading the validation section in
Are there any specific examples which come to mind, for this problem.

Well the docs is a good place to start - Node properties : Node-RED

As I said above, I've read the documentation, but the example given in the docs is quite complex, and does not describe the context of how it's implemented.
I've also looked at a number of contrib nodes for a basic example, but it appears to be rarely used.

It just needs to be a function that returns Boolean true (for valid) or false.

Unfortunately I cannot check their npm version now ...
But looking at their github demo version code, I would expect their current existing validation function to work correctly at first sight. Since it already takes into account the checkbox value. Perhaps this is not available in your npm version yet??

1 Like

These validators have been added on 7 october on Github (see this commit).

Thanks Bart, I'm using npm v6.14.11, tried on 2 machines, and the author can also replicate the issue.
Using the current version of smarthome (v0.0.64), the validation is throwing up the warning (screenshots in the git issue).

I guess I'll leave it to someone more competent than me to fix :grimacing:
I was just trying to contribute and learn a little along the way...

Sorry Paul,
Cannot debug your issue...
Just answering from my smartphone...

No worries, I'm sure it will get fixed.
You have helped me by pointing me to the validation functions, at least I can now see how validation should work!

1 Like

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