Can someone tell me why this does not work?

This is a button action on the web side - I am using Java script.  Should open a dialog box, the user should type a text string in, then a field on the form is populated.  

Right now the box comes up and I can type in it - press ok and thats it nothing else happens.

cw=window.open('','','height=120,width=200');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Comment</title></head>'+
'<body><form><h3>Please Enter Comment</h3>'+
'<input type=text name=add_comment_2><br>'+
'<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();
JaziarAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

JaziarAuthor Commented:
I guess I should include what I am doing on the notes Client

add_comment_1 := @Prompt([OKCANCELEDIT]; "Add Comment"; "Please Enter Comment"; " ");
add_comment_2 := @Name([CN]; @UserName) + " " + @Text @Now) + @NewLine + add_comment_1;
@SetField("CommentHistory"; CommentHistory:add_comment_2);
@SetField("Comments"; "");  

Only the CommentHistory field shows all others are hidden.
0
ZvonkoSystems architectCommented:
Hello Jaziar,

did you not receive the notification about my comment?

Anyway, I am glad abut the new offering. My very special Bro just managed to steal again my points :-)

I will give this code again a test and look for possible error traps.

We could speed up the process when you would send your database to zvonko@mysite.de
Zip it when greater then 3MB.

0
JaziarAuthor Commented:
I did not see it until after I posted this question.  
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

ZvonkoSystems architectCommented:
Ok, now main pit fall is the wrong field name encapsulation in JavaScript.

Do your Notes fields spell exactly like this:
Comments
CommentHistory
and the button html name: RefreshButton

Also is absolute necessary that your Form has this property enabled:
GenerateHtmlForAllFields

Please check this again and send me your db if you can.

0
JaziarAuthor Commented:
Comments
CommentPrefix
CommentHistory

RefreshButton

Yes GenerateHtmlForAllFields is checked but
Treat documents contents as HTML is not checked.
0
ZvonkoSystems architectCommented:
Which browser do you use for testing? IE or NS?
In IE you will get small error icon in lower left corner.
In NS you have to type javascript: to get the error console.

Increase the popup window size and request status to see the error.

Here are the changes:

cw=window.open('','','height=620,width=600,status');
0
ZvonkoSystems architectCommented:
I just recreated a new form with cut and pasted code from here and it works.

Please send me this database.

0
JaziarAuthor Commented:
I can not send the database - Company policies - All databases are confidental - Sorry
0
JaziarAuthor Commented:
OK it is now adding the comment to the form which is great but when I hit refresh but the dialog box is not closing.
0
JaziarAuthor Commented:
error says error on page when I hit OK
0
ZvonkoSystems architectCommented:
OK, now double-click this error in lower left corner of the popup window and you will get an error dialog window.

Tell me what error occurred.

0
ZvonkoSystems architectCommented:
Oh, now I read: you get the comment when you hit refresh?
Ok, then the remote RefreshButton click failed.

Check again for correct spelling of html NAME of this button.

0
JaziarAuthor Commented:
'opener.document.forms[0].RefreshButton.onclick();window.close()">'+  is null or not a object

The name of the button and the code match
0
JaziarAuthor Commented:
THis is the source code on the actual page -

return false;" HREF="">Add Web Comment</A></TD><TD><A HREF="" onClick="return _doClick('e8a50a3d91db5f3c85256ccc0065c980/$V5ACTIONS/0.52D2', this, null)" TARGET="_self">RefreshButton</A></TD></TR>
0
ZvonkoSystems architectCommented:
There is something wrong with this error message.

Please compare your html code in browser to mine.
Or paste here your html of the pupup so I can compare.

Here is mine:
<html><head><title>Add Comment</title></head><body><form><h3>Please Enter Comment</h3><input type=text name=add_comment_2><br><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>


0
ZvonkoSystems architectCommented:
What do you mean with "actual page"?
Is this the parent Form where the AddComment button reside?

And your RefreshButton is NOT a button!

0
JaziarAuthor Commented:
HEre is the popup source

<html><head><title>Add Comment</title></head><body><form><h3>Please Enter Comment</h3><input type=text name=add_comment_2><br><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>
0
ZvonkoSystems architectCommented:
I have an idea: send me the complete text of html source of your web page.

You have my address? zvonko@mysite.de

0
JaziarAuthor Commented:
Sorry I meant I viewed the source code on the form - The buttons are on top of the form - I have (Add Web Comment) (RefreshButton) these buttons
0
JaziarAuthor Commented:
I sent it
0
ZvonkoSystems architectCommented:
Both, (Add Web Comment)and (RefreshButton) are NOT buttons.
They are HotSpot links. They can not have html names.
You see this on the <A> html tags.
The buttons look like this in html:
<INPUT TYPE=button VALUE="Refresh" NAME="RefreshButton" onClick="return _doClick('522e617550f08a96c1256cdb006e1627/$Body/0.646', this, null)">

So now you have to create a Button anywhere on the main Form and give it this @Formula:
@Command([ViewRefreshFields])

In the property dialog for this Button enter in the last tab labeled with <HTML> this options:
Name: RefreshButton
Style: display:none

0
ZvonkoSystems architectCommented:
Ok, I got your html code.

Now I see. This <A> tags are not HotSpots, this are Actions!

For Actions it is not possible to give them html names.
So please create a real Button for this RefreshButton.

0
JaziarAuthor Commented:
I tried it but I get the same thing - I will be back Monday morning - I must be missing something - for all your time more points
0
JaziarAuthor Commented:
I can only create a Hotspot button - should it be hidden? or will they need to click it
0
JaziarAuthor Commented:
Should the comment button also be a real button and not a action tag?
0
ZvonkoSystems architectCommented:
AddWebComment works now as is, so let it be.
But RefreshButton needs to be clickable by JavaScript, and this can be done only by real html buttons. The button does not need to be visible for the web user. It has only to be callable by JavaScript.

See you on Monday :-)

0
JaziarAuthor Commented:
OK I have the button working :) - but is there a way we can put a save in the script somewhere.  I adds the comment to the form but does not save it.  So we I reopen the form the comment is gone.  We are getting there.
0
ZvonkoSystems architectCommented:
CommentHistory is only an Item on you main Document.
If you like that CommentHistory is stored, then you have to Save the Document.

Simply add the Save command to RefreshButton formulas.
Like this:

@Command([ViewRefreshFields]);
@Command([FileSave])

That's all.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
JaziarAuthor Commented:
Thanks for the hard work and staying with me during all my trails and errors.  It was very important I get this working and thanks to your help it is.  Job well done!!
0
ZvonkoSystems architectCommented:
Oh, thank you for the points, grading and for the feedback :-)

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.