vendredi 1 septembre 2017

create checkbox in dashboard ui_template (node-red) in loop and assign check-status to output msg.payload

I am createing checkboxes in a loop from an initial input msg.payload (please see the code below which is working). Example for the ingoing payload: msg.payload=[{"NAME":"a"},{"NAME":"b"}]

<form>
    <fieldset style="width:85%">
    <legend>choose chartdata</legend>
        <div ng-repeat="x in msg.payload">
            <input type="checkbox" name=>
            <label for=></label>
        </div>
    </fieldset>
</form>

I am trying to get an output msg.payload (to be pushed to the flow) for every checkbox (on change) which contains the name of the checkbox (here: "a" or "b") and the status (checked/unchecked).

Does any body know how this could be done?

chee­rio

CE

p.s.: here the flow:

[{"id":"3bbd849e.391734","type":"inject","z":"256e6f3d.da9f7","name":"","topic":"","payload":"[{\"NAME\":\"a\"},{\"NAME\":\"b\"}]","payloadType":"json","repeat":"","crontab":"","once":false,"x":341.08331298828125,"y":216.08334350585938,"wires":[["f6bae45e.b99088"]]},{"id":"f6bae45e.b99088","type":"ui_template","z":"256e6f3d.da9f7","group":"34890ec3.1f4b6a","name":"checkbox","order":11,"width":"3","height":"8","format":"\n \n choose chartdata\n \n \n \n \n \n","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":513.4889526367188,"y":217.39315795898438,"wires":[[]]},{"id":"34890ec3.1f4b6a","type":"ui_group","name":"Group 1","tab":"a52427c4.c3901","order":1,"disp":true,"width":6},{"id":"a52427c4.c3901","type":"ui_tab","z":"","name":"test","icon":"dashboard","order":12}]




Aucun commentaire:

Enregistrer un commentaire