I don't normally broadcast this kind of thing but it was one of those situations where I had been gesturing rudely at the computer screen for hours on end before finally having the revelation: when validating a web form with JavaScript, it will fail if you have hyphens in the form names.
I've been doing this kind of thing for over ten years and I don't recall this ever coming up before.
Normally, when you validate a form, if the code detects a problem (e.g. an empty field that is required, or an email address that's not a real address) it aborts the submission of the form, thus saving time both for the user and the server. But the form I was working with defied this basic rule - it always successfully detected the problem, but then went ahead and allowed the form to be submitted anyway. Removing hyphens from the field names resolved the issue.
Special characters are typically things such as apostrophes or dollar signs, characters that have meaning in cod as well as normal language. But I had thought hyphens were safe.
The surprise to me is that, while googling the keywords almost always provides the needed answer, this one came up with nothing. It felt like I was back in 1996 or something.
I hope future generations will benefit from my wasted time.
Roedy Green has a funny (and very long) guide called How To Write Unmaintainable Code [Ensure a job for life ;-)]
Misleading names
Make sure that every method does a little bit more (or less) than its name suggests. As a simple example, a method named isValid(x) should as a side effect convert x to binary and store the result in a database.
Recent comments
18 weeks 6 days ago
28 weeks 4 days ago
39 weeks 6 days ago
40 weeks 6 days ago
40 weeks 6 days ago
1 year 2 weeks ago