Link to home
Start Free TrialLog in
Avatar of Jaziar
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('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>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].Comments.value=\'\';'+
'opener.document.forms[0].CommentHistory.value+=\'\\n\'+'+
'opener.document.forms[0].CommentPrefix.value+'+
'document.forms[0].add_comment_2.value;'+
'opener.document.forms[0].RefreshButton.onclick();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.Comments' is null or not a object
Code: 0
URL: Gives the URL
ASKER CERTIFIED SOLUTION
Avatar of qwaletee
qwaletee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of qwaletee
qwaletee

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

Avatar of Sjef Bosman
The object opener isn't defined anywhere, at least not on the window you create. Try parent.document.forms[0]...
Avatar of Jaziar

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
Jaziar, JS is case sensitive.. ! So Check the spelling of the comment field and replace it accordingly in your button script.

~Hemanth