We all know that the web is poorly designed for application development.
I'm struggling with the concept of which radio button should be checked
based on a D variable.
Everyone here probably knows this, but in html, the way you say which
radio button is checked is to add a "checked='anything'" to the radio
Let's say you have a boolean value, and you want to check "yes" or "no"
depending on that value. I'm looking at this code I wrote, and it's awful:
#b Boolean is set: - if(mybool) input#b_yes(type='radio',name='b',value=1,checked='1') label(for='b_yes') Yes input#b_no(type='radio',name='b',value=0) label(for='b_no') No - else input#b_yes(type='radio',name='b',value=1) label(for='b_yes') Yes input#b_no(type='radio',name='b',value=0,checked='1') label(for='b_no') No
Can diet handle adding or not adding an attribute based on a D boolean?
That would make this a LOT better.
You can imagine a set of radio buttons that is larger being even more
horrible, though looping and nesting the if statement makes it a little
more palatable (but not by much).