How to set an limit to the value entered in text input node

Hi
I want to create an input box for my dashboard which has a limit of min = 0 and max = 100 value so only value within the limit can be entered
I am using text input node but unable to set this min and max value
Thanks

Can you use the numeric input node instead? That allows a range to be specified.

you could add a switch and change node to validate your input.
e.g.

[{"id":"a085d44b.1361f","type":"ui_text_input","z":"9a86d59e88442f2c","name":"","label":"","tooltip":"","group":"2d4fe667.28f8ba","order":10,"width":0,"height":0,"passthru":false,"mode":"number","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":330,"y":300,"wires":[["6d6e18d7.8fc69"]]},{"id":"e716a705.8ae3","type":"change","z":"9a86d59e88442f2c","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload > 100 ? 100 : 0","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":380,"y":360,"wires":[["a085d44b.1361f"]]},{"id":"6d6e18d7.8fc69","type":"switch","z":"9a86d59e88442f2c","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"100","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":520,"y":300,"wires":[["eb30ff93.865c28"],["e716a705.8ae3"]]},{"id":"eb30ff93.865c28","type":"debug","z":"9a86d59e88442f2c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":690,"y":280,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

How to make numeric node to only send value when pressed enter

I don't think that is possible.

Hi
Instead of it setting to high (100) or low(0) value when validation fails can we make it to show the previous validated value

Yes, just store the validated value after the switch node, and recall it in the change node
e.g.

[{"id":"46a3ef25.e51988","type":"ui_text_input","z":"30af2d3e.d94ea2","name":"","label":"","tooltip":"","group":"2d4fe667.28f8ba","order":10,"width":0,"height":0,"passthru":false,"mode":"number","delay":"0","topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":230,"y":280,"wires":[["b8ba37a5.b83c6"]]},{"id":"508058d5.00d08","type":"change","z":"30af2d3e.d94ea2","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"previous","tot":"flow"}],"action":"","property":"","from":"","to":"","reg":false,"x":280,"y":340,"wires":[["46a3ef25.e51988"]]},{"id":"b8ba37a5.b83c6","type":"switch","z":"30af2d3e.d94ea2","name":"","property":"payload","propertyType":"msg","rules":[{"t":"btwn","v":"0","vt":"num","v2":"100","v2t":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":2,"x":420,"y":280,"wires":[["65f03d12.e0b5ec"],["508058d5.00d08"]]},{"id":"65f03d12.e0b5ec","type":"change","z":"30af2d3e.d94ea2","name":"","rules":[{"t":"set","p":"previous","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":600,"y":260,"wires":[["dc534367.9d975"]]},{"id":"dc534367.9d975","type":"debug","z":"30af2d3e.d94ea2","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":810,"y":260,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

Thanks For The Help !

Hi
One Last Thing When I am disabling the text input node the the value in the text box is changing How can I keep the Same Value before disabling it

I don't see that. What is it changing from/to?

I would suspect that when you disable you are also feeding in a msg.payload, hard to say without seeing your flow.

HI
When i have payload value is equal to 0 I have to disable the input node when it is equal to 1 enable it

[
    {
        "id": "3938c99931cd8d33",
        "type": "ui_text_input",
        "z": "0b2bb18eaac24be5",
        "name": "",
        "label": "",
        "tooltip": "",
        "group": "78fdd8ca6d0e5ae8",
        "order": 2,
        "width": "2",
        "height": "3",
        "passthru": true,
        "mode": "number",
        "delay": "0",
        "topic": "topic",
        "sendOnBlur": false,
        "className": "",
        "topicType": "msg",
        "x": 610,
        "y": 980,
        "wires": [
            [
                "4187c5b465f8e158"
            ]
        ]
    },
    {
        "id": "7e15aca24d6f1348",
        "type": "function",
        "z": "0b2bb18eaac24be5",
        "name": "function 25",
        "func": "msg.enabled = false;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 960,
        "wires": [
            [
                "3938c99931cd8d33"
            ]
        ]
    },
    {
        "id": "22fb1ce473ee0dc7",
        "type": "function",
        "z": "0b2bb18eaac24be5",
        "name": "function 26",
        "func": "msg.enabled = true;\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 450,
        "y": 1000,
        "wires": [
            [
                "3938c99931cd8d33"
            ]
        ]
    },
    {
        "id": "71be8eed9ff6e8bf",
        "type": "switch",
        "z": "0b2bb18eaac24be5",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 310,
        "y": 980,
        "wires": [
            [
                "7e15aca24d6f1348"
            ],
            [
                "22fb1ce473ee0dc7"
            ]
        ]
    },
    {
        "id": "8f920d217b07bd1a",
        "type": "inject",
        "z": "0b2bb18eaac24be5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "x": 150,
        "y": 960,
        "wires": [
            [
                "71be8eed9ff6e8bf"
            ]
        ]
    },
    {
        "id": "2aa71e6d7ac3601d",
        "type": "inject",
        "z": "0b2bb18eaac24be5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "x": 150,
        "y": 1000,
        "wires": [
            [
                "71be8eed9ff6e8bf"
            ]
        ]
    },
    {
        "id": "4187c5b465f8e158",
        "type": "debug",
        "z": "0b2bb18eaac24be5",
        "name": "debug 58",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 760,
        "y": 980,
        "wires": []
    },
    {
        "id": "78fdd8ca6d0e5ae8",
        "type": "ui_group",
        "z": "0b2bb18eaac24be5",
        "name": "Set Point ",
        "tab": "4d6c02f95a8f26c8",
        "order": 11,
        "disp": true,
        "width": "23",
        "collapse": false,
        "className": "sp"
    },
    {
        "id": "4d6c02f95a8f26c8",
        "type": "ui_tab",
        "name": "LCC Control",
        "icon": "fa-gear",
        "order": 7,
        "disabled": false,
        "hidden": false
    }
]

When you disable it, what value does it change to, and what is in msg.payload in the message that disables it?

As suspected you are feeding a msg.payload in with msg.enabled, delete msg.payload, also uncheck if msg arrives pass on input, through to output

[{"id":"8f920d217b07bd1a","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":70,"y":3520,"wires":[["7e15aca24d6f1348"]]},{"id":"7e15aca24d6f1348","type":"function","z":"30af2d3e.d94ea2","name":"function 25","func":"msg.enabled = msg.payload === 1 ? true : false;\ndelete msg.payload\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":300,"y":3540,"wires":[["3938c99931cd8d33"]]},{"id":"2aa71e6d7ac3601d","type":"inject","z":"30af2d3e.d94ea2","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":70,"y":3560,"wires":[["7e15aca24d6f1348"]]},{"id":"3938c99931cd8d33","type":"ui_text_input","z":"30af2d3e.d94ea2","name":"","label":"","tooltip":"","group":"78fdd8ca6d0e5ae8","order":2,"width":"2","height":"3","passthru":false,"mode":"number","delay":"0","topic":"topic","sendOnBlur":false,"className":"","topicType":"msg","x":530,"y":3540,"wires":[["4187c5b465f8e158"]]},{"id":"4187c5b465f8e158","type":"debug","z":"30af2d3e.d94ea2","name":"debug 58","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":3480,"wires":[]},{"id":"78fdd8ca6d0e5ae8","type":"ui_group","z":"30af2d3e.d94ea2","name":"Set Point ","tab":"4d6c02f95a8f26c8","order":11,"disp":true,"width":"23","collapse":false,"className":"sp"},{"id":"4d6c02f95a8f26c8","type":"ui_tab","name":"LCC Control","icon":"fa-gear","order":7,"disabled":false,"hidden":false}]
1 Like

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