Hi,
I have this code, and it's not working, could someone help me please ?
Not sure Mustache is 100% supported by Node-Red or maybe it's a simplified version without all statements !?
[{"id":"55271cabcb3274a6","type":"http in","z":"1418dae22be032be","name":"","url":"/job/add","method":"get","upload":false,"swaggerDoc":"","x":850,"y":1380,"wires":[["5337cd7e2fce6e88"]]},{"id":"5337cd7e2fce6e88","type":"function","z":"1418dae22be032be","name":"Prepare vars","func":"//msg.payload = global.get('conf');\nmsg.payload = {\n containers :{\n 1: {\n checked : 1\n },\n 2: {\n checked : 1\n },\n 3: {\n checked : 0\n },\n 4: {\n checked : 0\n }, \n 5: {\n checked : 0\n },\n 6: {\n checked : 0\n }, \n 7: {\n checked : 0\n }\n }\n};\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":1030,"y":1380,"wires":[["3dd281899b8e760b","4922c9bcdc6ddb06"]]},{"id":"3dd281899b8e760b","type":"template","z":"1418dae22be032be","name":"modal - ajouter un job","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<div class=\"modal-dialog modal-lg\">\n <div class=\"modal-content\">\n\n\t\t<div class=\"modal-header\">\n\t\t\t<h5 class=\"modal-title\" id=\"exampleModalLabel\">title</h5>\n\t\t\t<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Annuler\"></button>\n\t\t</div>\n\t\t\n\t\t<div class=\"modal-body\">\n\t\t\t\n\t\t\t<form id=\"form-job-add\" method=\"post\" action=\"/job/add\">\n\t\t\t\t\n\t\t\t\t<input type=\"hidden\" name=\"ctrl\" value=\"job-edit\" />\n\t\t\t\t<input type=\"hidden\" name=\"cmd\" value=\"add\" />\n\t\t\t\t\n\t\t\t\t<div class=\"tab-pane container fade show active\" id=\"general\" role=\"tabpanel\" aria-labelledby=\"description-tab\">\n\t\t\t\t\n\t\t\t\t\t<div class=\"row mt-3\">\n\t\t\t\t\t\t<div class=\"col-12\">\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t<div class=\"row fabrication_order\">\n\t\t\t\t\t\t\t\t<table class=\"table-responsive table-sm table-fabrication_order_add\">\n\t\t\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<th scope=\"col\">Containers(s)</th>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t\t\t<td class=\"container pt3s\">\n\t\t\t\t\t\t\t\t\t\t\t\t{{#containers}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t{{#uuid}}\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<input type=\"checkbox\" id=\"{{.}}\" {{#checked}}checked{{/checked}} name=\"fabrication_order[][container][]\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<label for=\"{{.}}\">{{@index}}</label>\n\t\t\t\t\t\t\t\t\t\t\t\t\t{{/uuid}}\n\t\t\t\t\t\t\t\t\t\t\t\t{{/containers}}\n\t\t\t\t\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t\t\t</table>\n\t\t\t\t\t\t\t</div>\n\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t</div>\t\t\n\n\t\t\t</form>\n\t\t\t\n\t\t</div>\n\t\t\n\t\t<div class=\"modal-footer\">\n\t\t\t<button type=\"button\" id=\"btn-cancel\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\">Fermer</button>\n\t\t\t<button type=\"button\" id=\"btn-save\" class=\"btn btn-primary\">Enregistrer</button>\n\t\t</div>\n\t\t\n </div>\n</div>","output":"str","x":1260,"y":1380,"wires":[["665fc973cea60842"]]},{"id":"4922c9bcdc6ddb06","type":"debug","z":"1418dae22be032be","name":"debug 17","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1220,"y":1440,"wires":[]},{"id":"665fc973cea60842","type":"http response","z":"1418dae22be032be","name":"Send HTML","statusCode":"","headers":{},"x":1470,"y":1380,"wires":[]}]
Actually, I try to populate 7 checkboxes and auto-check them in a Mustache Template. I precise it's not used with Dashboard but with /get /post from ajax calls on html pages I control myself.