Archive for November, 2008

Show / hide table row in Firefox versus IE

November 28, 2008

Hiding a table row is fine, just set document.getElementById(‘theRow’).style.display = ‘none’

When you’re trying to show it though, it can get confusing – for it to display properly, you’ve to set display=’table-row’ for Firefox and display=’block’ for IE.

The solution? Set display=” and the display property for the element gets set to its default (‘table-row’ for FF and ‘block’ for Explorer).


Email and date validation without regular expressions

November 28, 2008

I just discovered filter_var() –  very handy for validating form input, I’ve switched over from validating emails with regular expressions and I use this instead now:


… so now I don’t have to worry me getting the regexp wrong and rejecting emails when I shouldn’t. Nice. I used to validate date using regular expressions too, changed that too recently to use checkdate() (another new discovery, even though it’s been around since php4).

If only javascript had better built-in functionality for validating this stuff on the client side too I’d be laughing

Safari javascript validation problem

November 19, 2008

This seems to becoming more of a javascript blog lately …

Anyway, I was editing some javascript validation code that was written by someone else, and it wouldn’t work in Safari although it was working fine in FF and IE. The quirky thing about the validation code was it was making sure ALL form variables except specifically-excluded ones had a value (I normally do it the other way around, check specific variables have a value) and, it turned out, the problem with Safari was unchecked radio buttons get submitted as blank values – in IE and FF they just don’t get sent in the http post request. Added those to the list of variables excluded and it worked