Thursday, January 22, 2009

Adventures in Coding

So, let's say your a web developer. What's the first thing you probably learned way back when you were just starting out? I'll hazard a guess and say, making a page with a couple of fields in it like text boxes, and for the really advanced a drop down list, where a user could enter some information, click a button and that information would get saved or sent somewhere.

Sounds about right, huh?

For the non-web developers out there, here's an example of the previously mentioned drop down list that would get added to a page.

<select name="YouAreADunce">
<option value="0">Yes
<option value="1">No
</select>

Rendered as:


Pretty basic stuff for a web developer, no?

Good, I'm glad you agree with me. At least I know that my irritation at the coworker with the fat salary, five page resume and computer science degree who couldn't figure out why a drop down list that Thing 1 just added to a page was returning a 0 or a 1 and not "Yes" or "No" when Thing 1 submitted the form was justified.

Ok, so you don't know anything about web development. Nothing. Zero. Nada. It doesn't matter. Its a simple problem to figure out. The answer is RIGHT THERE.

"Hmm. I was expecting 'Yes' but I got '0'. I wonder why. Oh, look, '0' is the value of that drop down item. That must be why I am getting a '0'. I want a 'Yes' so let me change that value from '0' to 'Yes'."

Of course, why Thing 1 is using Request.Form to get the values of the form fields in the code-behind of a .NET page is a WTF for another day. I wasn't going to touch that with a ten foot pole.

3 comments:

Pete said...

i would like to apply for a job where you work.

YouWho said...

Tell them to close their option tags too, wouldja?

gagknee said...

sure, pete, but i don't know if i could take another person with a higher salary than me. might drive me over the edge.

haha, youwho, i actually did close them in the source code. i guess my boss is right i need to be more consistent.