Yes­ter­day, I spent six (6) hours chas­ing down one (1) bug in a web-based pro­gram I am writ­ing for work.

Oy.

This is going to get a bit geeky.

I have a form that pulls data for a select box from a MySQL data­base. Based on what the user chooses in that select (a drop-down box for you non-geeks), a sec­ond select needs to be pop­u­lated from the data­base. I could pull all the data the first time, and just parse out the appro­pri­ate mate­r­ial when the user makes their choice, but it is a lot of data, and it seems like that is not the right way.

Instead, when the user chooses from the first select box, it trig­gers a javascript func­tion with onChange, and that func­tion actu­ally sub­mits the form using sub­mit(), but not until chang­ing a vari­able in a hid­den field that indi­cates to the page that the data should not actu­ally be INSERTed into the data­base. Instead, it uses this sec­ond reload of the page to pull the data for the sec­ond select.

Only, it wasn’t work­ing. The javascript sub­mit() just wouldn’t go. I spent six hours try­ing to debug it, includ­ing writ­ing the page over, find­ing another page online that did much the same thing, and com­par­ing it, strip­ping out all the extra­ne­ous mate­r­ial from my form until it looked like that work­ing form… and then, yes­ter­day at 4:05 pm, I found it.

My form has a sub­mit but­ton. It was coded like this:

<input type="submit" name="submit" value="Add this Client"/>

The form I found that worked, was coded like this:

<input type="submit" name="Submit" value="Add this Client"/>

And this, ladies and gen­tle­men, is why I don’t want to be a programmer.

 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Set your Twitter account name in your settings to use the TwitterBar Section.