Hi, recently, I downloaded a script to make MySQL database changes through a web interface written in php, and with some javascript. Everything works quite fine, except when I try to make changes to the database. I'll explain how the script works... It outputs a table with all fields in a database, and I can add rows and delete them, so that part is working fine. But then I type something in the textfield of an existing table field, to make changes, the table row gets another color to show that a change has been made, and the 'Make changes' submit button gets enabled, which stays disabled if you don't touch the existing fields, so untill here still working fine. But it's when I try to submit the 'form' that I get a javascript error. It's saying 'Object is required', and when I look at the lines of the error, it says this: function datecheck(month,day,year){ //checks for illegal dates obj = document.getElementById(month); if(obj.value > 12 || obj.value < 1 || obj.value == "") { alert('Enter valid month.'); return false; } So I have been trying to figure out what exactly the problem could be, but I can't find it. Have been trying to remove parts of the javascript, but then I got other errors, and it has gone from bad to worse. So I'm a bit stuck here... Is there anyone who can help me with this ? I'll post the full code if someone is interested in checking... cheers, Jurgen
Looks like document.getElementById(month) doesn't return a valid object. Make sure that there is an element with ID passed as 'month' (first parameter) in the document. You may want to try: alert(month); alert(document.getElementById(month));