Hello,
i would like manage 7 checkbox on dashboard, each one for any day of the week.
A msg value with 1 bit for any checkbox is the input value to manage.
Then a msg output with flag status will need to be manage, but this still a next step. I try to make the code but i'm not expert, so i ask your help to correct the code. (i apologise for errors, as i said i'm not sw engineer.)
thank for cooperation
<div>
<input type="checkbox" id="doso0Day0" >Su
<input type="checkbox" id="doso0Day1" >Mo
<input type="checkbox" id="doso0Day2" >Tu
<input type="checkbox" id="doso0Day3" >We
<input type="checkbox" id="doso0Day4" >Th
<input type="checkbox" id="doso0Day5" >Fr
<input type="checkbox" id="doso0Day6" >Sa
</div>
<script>
(function(scope) {
// $watch fires each time the node is triggered in the flow
scope.$watch('msg', function(msg) {
if (msg.payload == 0) {
move();
}
DosoWeek0 = msg.payload;
if (DosoWeek0 & 1)
document.getElementById('doso0Day0').checked = true ;
else
document.getElementById('doso0Day0').checked = false ;
if (DosoWeek0 & 2)
document.getElementById('doso0Day1').checked = true ;
else
document.getElementById('doso0Day1').checked = false ;
if (DosoWeek0 & 4)
document.getElementById('doso0Day2').checked = true ;
else
document.getElementById('doso0Day2').checked = false ;
if (DosoWeek0 & 8)
document.getElementById('doso0Day3').checked = true ;
else
document.getElementById('doso0Day3').checked = false ;
if (DosoWeek0 & 16)
document.getElementById('doso0Day4').checked = true ;
else
document.getElementById('doso0Day4').checked = false ;
if (DosoWeek0 & 32)
document.getElementById('doso0Day5').checked = true ;
else
document.getElementById('doso0Day5').checked = false ;
if (DosoWeek0 & 64)
document.getElementById('doso0Day6').checked = true ;
else
document.getElementById('doso0Day6').checked = false ;
})
})(scope);
</script>