Jaziar
asked on
Error when trying to add a comment on my web form
I have a add comment button on my form for browser users. Here is the code
cw=window.open('','','heig ht=150,wid th=300,sta tus');
cw.moveTo(200,200);
cw.document.write('<html>< head><titl e>Add Comment</title></head>'+
'<body><form><h3>Please Enter Comment</h3>'+
'<textarea name=add_comment_2 rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document. forms[0].C omments.va lue=\'\';' +
'opener.document.forms[0]. CommentHis tory.value +=\'\\n\'+ '+
'opener.document.forms[0]. CommentPre fix.value+ '+
'document.forms[0].add_com ment_2.val ue;'+
'opener.document.forms[0]. RefreshBut ton.onclic k();window .close()"> '+
'<input type=button value=Cancel '+
'onClick="window.close()"> '+
'</form></body></html>');
cw.document.close();
The prompt comes up and I can enter a text - then when I hit OK
I get error on page and here is the error
Line: 1
Char: 1
Error: 'opener.document.forms.0.C omments' is null or not a object
Code: 0
URL: Gives the URL
cw=window.open('','','heig
cw.moveTo(200,200);
cw.document.write('<html><
'<body><form><h3>Please Enter Comment</h3>'+
'<textarea name=add_comment_2 rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.
'opener.document.forms[0].
'opener.document.forms[0].
'document.forms[0].add_com
'opener.document.forms[0].
'<input type=button value=Cancel '+
'onClick="window.close()">
'</form></body></html>');
cw.document.close();
The prompt comes up and I can enter a text - then when I hit OK
I get error on page and here is the error
Line: 1
Char: 1
Error: 'opener.document.forms.0.C
Code: 0
URL: Gives the URL
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why is this in Aplications\Email General\Lotus Notes? It should be in Web Development\Application Servers!
Oops, sorry, wrong window on the last comment
The object opener isn't defined anywhere, at least not on the window you create. Try parent.document.forms[0].. .
ASKER
Thanks for the promptness - So I added 25 more points - It was the Generate HTML problem. I also had a problem with the refresh button, but I resolved it.
Thanks Again
Thanks Again
Jaziar, JS is case sensitive.. ! So Check the spelling of the comment field and replace it accordingly in your button script.
~Hemanth
~Hemanth