bad code
I hate negative fieldnames
Submitted by Doug Sims on Thu, 2006-12-14 20:16. bad code | rantJust had to dive into an un-named co-worker's code to look at an issue. Please never name your boolean fieldnames in the negative, I may have to interprit your code and I have no patience for these antics!
here is the scenario:
there is a negativly named field in the DB named boo_nonsmoker.
here is the Radio Button code block
<input type="radio" name="boo_flex_nonsmoker_NewValue1" value="F" <cfif not BooleanIsTrue(qryEmployee.boo_flex_nonsmoker)>checked</cfif>>
“I certify that I am a non-smoker.”
<br>
<input type="radio" name="boo_flex_nonsmoker_NewValue1" value="T" <cfif BooleanIsTrue(qryEmployee.boo_flex_nonsmoker)>checked</cfif>>I and/or my spouse is a smoker.So in this scenario if they smoke, boo_nonsmoker gets set to true, making it really a flag for smokers, not nonsmokers.....it gets even more confusing when setting the default value...cfif not BooleanIsTrue nonsmoker.


delicious
digg
reddit
technorati