Forum Home
Press F1
 
Thread ID: 83404 2007-09-30 21:48:00 Javascript form checking Morgenmuffel (187) Press F1
Post ID Timestamp Content User
596483 2007-09-30 21:48:00 Hi all

I have always done server side checking with my forms using php, but someone recently asked if i could also add javascript field checking as it is a bit quicker, do they work OK together and are there any caveats I should be aware of.
Obviously i wan to keep the server side checking as i trust it a damn site more than javascript, and the server side stuff isn't browser specific whereas last time i used javascript i had to put all sorts of crud in to deal with Various versions of IE and Netscape

any help would be appreciated
Morgenmuffel (187)
596484 2007-09-30 21:52:00 I haven't used PHP, but ASP.NET.
You may have some fun when someone disables Javascript in their browser...
Bozo (8540)
596485 2007-09-30 22:06:00 You can quite happily use both methods - they won't conflict. One thing you should never do though is trust the javascript checking - anything you care about, check it again on the server. Client data can be tampered with, javascript can be disabled etc.

Yes, there are several different implementations for different browsers, but for something as simple as validating forms you should be able to get away with the same code for all of them, provided you stick to the normal DOM methods or use IDs & getElementById().
Erayd (23)
1