
What I'm after is a numerical attribute ('counter') that, when pushed above or below specific but irregular thresholds, will change the value of another numerical attribute ('rating'). I.e. Counter = 0,1 Rating = 0 Counter = 2,3,4 Rating = 1 Counter = 5,6,7,8,9 Rating = 2 Counter = 10+ Rating = 3 Here's what I've got: <input type="number" name="attr_counter" min="0" /> <input type="number" name="attr_rating" min="0" /> <script type="text/worker"> on('change:counter', () => { getAttrs(['counter', 'rating'], v=> { let newcounter = parseInt(v.counter) || 0; let newrating = parseInt(v.rating) || 0; if(newcounter < 2) { newrating = 0; } if(newcounter > 1 && newcounter < 5) { newrating = 1; } if(newcounter > 4 && newcounter < 10) { newrating = 2; } if(newcounter > 9) { newrating = 3; } setAttrs({ rating: newrating }) }) }); </script> Am I close, or on a very wrong track? Can anyone please advise?