So I was playing around with phpBB3 RC5, the latest version of the popular phpBB forum software, when I ran into this error. It’s not a PHP error, actually, but a JavaScript one. I’m working on heavily modifying a phpBB install, and in this case I wanted it to submit a new topic automatically.

The form’s name is postform, so I could just do:

document.postform.submit();

right? No go. I got the above error in Firebug, which claims postform has no properties. After lots of Googling, I found a fix:

document.getElementById(’postform’).submit();

But this still wasn’t working right, because phpBB wasn’t responding properly. Instead of posting the message, like it would if I had clicked Submit manually, it was just showing me the post form again. The key was the click. So instead of submitting, let’s click!

document.getElementById(’postform’).click();

It works!

This entry was posted on Thursday, August 30th, 2007 at 4:18 pm and is filed under JavaScript, PHP. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply