Javascript Submit problem in NS4
I have a form that I want to validate with javascript and then submit. The form name is vbform and here's the javascript function that gets called.
function replyIm() {
if(document.vbform.message.value == '') {
alert('Please enter a reply message.');
}
else {
document.vbform.cmd.value = 'doreplyim';
document.vbform.submit();
}
}
I call the function like this:
The reason I do that is because I have to buttons, one to reply and one to close the im.
This works fine in everything but NS4, where it gives a "document contains no data" message. The thing is it still submits the form and replies. The window just doesn't close like it should in the post back code.
Here's what I call in the post back section to close the window. This is echo'd from php code:
echo "<html><head><title></title><script language=\"javascript\"><!--\n
window.close(); //-->\n
</script></head><body></body></html>";
Thanks for any help,
Mark
Webmaster
http://www.lancerforums.com
dk01 posted this at 11:18 — 14th April 2002.
He has: 516 posts
Joined: Mar 2002
This stumps me! I have not tested it myself but I can't think why this wouldn't work. Have you tried doing the reverse? For example putting:
if(document.vbform.message.value != '')
I would try this because it sounds to me like some sort of ns bug that was never fixed. Maybe your NS4 version is an older one or something. Very puzzling to me. Sorry I can't help much.
-dk
Abhishek Reddy posted this at 11:33 — 14th April 2002.
He has: 3,348 posts
Joined: Jul 2001
I believe that the DOM for a form is document.forms.formname.formelementname.value
So just try inserting ".forms" between "document" and ".vbform"
I don't think that this is your problem, but it's just a thought.
Have you looked at the output source for the post back page? You might find some clues there if it's a problem with the php.
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.