I Like The New Facebook Layout

I think I’m one of very few people who liked the new facebook layout right off the bat.  And here’s why…

Coding PHP Zend Framework

Posting Defaults for Checkboxes

I was playing around with Zend_Form a little while ago and I realized they did something neat with checkboxes.

Everytime I created a checkbox, Zend made two.

<input id="optInDefault" name="optIn" type="hidden" value="n" />
<input id="optIn" name="optIn" type="checkbox" value="y" />

One hidden, and one not.  This is handy because when the user doesn’t check it – the hidden value gets posted. When the checkbox is selected, that value overrides the hidden one.

This also works for radio buttons, or any other form element where you want a default value posted.