Radio button input

961 views
Skip to first unread message

sitius

unread,
Jan 17, 2016, 12:34:48 AM1/17/16
to Node-RED
Hi. Can someone show me an example or point me the way to implement a radio button input in node red? Thanks

Mark Setrem

unread,
Jan 17, 2016, 4:32:06 AM1/17/16
to Node-RED
What are you trying to do? 
Where do you want a radio check button?


If you want to do it to control input to a flow you need to think of doing it in a different way.  
One way would be to have the flow started from a webpage using the http nodes. 
You can then have the radio buttons and any other inputs you want.


sitius

unread,
Jan 17, 2016, 10:59:36 AM1/17/16
to Node-RED

Sorry to not have been clear in my question: what I'm looking for is a way to use a radio input in a node, not in a flow. Having in the html part

 <input type="radio" id = "id1" name="myButton" value="value1">option1<br>
<input type="radio" id = "id2" name="myButton" value="value2">option2<br>

passing the input value to the js file using  defaults  id1: {value:""} doesnt work as the radio button only can be acessed with a script.
So is there a way to pass the radio input value using defaults or the option is to get the value from html directly from the js file. Thanks

Julian Knight

unread,
Jan 17, 2016, 11:38:43 AM1/17/16
to Node-RED
The easy way is to look at node-red-contrib-ui as it is easy to build a dynamic ui that way.

Doing it by hand, make sure you have the inputs inside a "form" structure and have a submit button pointing at your http in node. Then look in the "res" object structure that is returned by the http in node.

You can also hand-craft your own more dynamic approach using websockets - check out my examples on the flows site (search for "totallyinformation").

sitius

unread,
Jan 17, 2016, 1:39:27 PM1/17/16
to Node-RED


The input option will be used in the edit node dialog box and not in the node ui after being deployed, if I can explain it right. What I'm looking for is a way to register the input choice, like shown in the image, in the editable properties (defaults)

Nicholas O'Leary

unread,
Jan 17, 2016, 5:10:55 PM1/17/16
to Node-RED Mailing List
Hi,

the editor only knows how to automatically populate text inputs, select boxes and checkboxes; we don't support radio buttons. That isn't a specific choice we've made; we've simply never had a node that needed them. In fact, anywhere we might have used them, we've used a select box instead.

If you want to use radio boxes you'll have to use the oneditprepare and oneditsave functions in the node's definition in order to populate them and read their values back.

Nick



On 17 January 2016 at 18:39, sitius <siti...@gmail.com> wrote:


The input option will be used in the edit node dialog box and not in the node ui after being deployed, if I can explain it right. What I'm looking for is a way to register the input choice, like shown in the image, in the editable properties (defaults)

--
http://nodered.org
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

sitius

unread,
Jan 17, 2016, 5:38:13 PM1/17/16
to Node-RED
So that's why I couldn't find an example with them after searching for hours!
Well, the radio buttons would be cooler than the selectable box :) I'm going to try your suggestion. I appreciate the help of all. Thanks
Reply all
Reply to author
Forward
0 new messages