Link to home
Start Free TrialLog in
Avatar of Jaziar
Jaziar

asked on

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();
Avatar of Jaziar
Jaziar

ASKER

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.
Avatar of Zvonko
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.

Avatar of Jaziar

ASKER

I did not see it until after I posted this question.  
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.

Avatar of Jaziar

ASKER

Comments
CommentPrefix
CommentHistory

RefreshButton

Yes GenerateHtmlForAllFields is checked but
Treat documents contents as HTML is not checked.
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');
I just recreated a new form with cut and pasted code from here and it works.

Please send me this database.

Avatar of Jaziar

ASKER

I can not send the database - Company policies - All databases are confidental - Sorry
Avatar of Jaziar

ASKER

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.
Avatar of Jaziar

ASKER

error says error on page when I hit OK
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.

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.

Avatar of Jaziar

ASKER

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

The name of the button and the code match
Avatar of Jaziar

ASKER

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>
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>


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

And your RefreshButton is NOT a button!

Avatar of Jaziar

ASKER

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>
I have an idea: send me the complete text of html source of your web page.

You have my address? zvonko@mysite.de

Avatar of Jaziar

ASKER

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
Avatar of Jaziar

ASKER

I sent it
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

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.

Avatar of Jaziar

ASKER

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
Avatar of Jaziar

ASKER

I can only create a Hotspot button - should it be hidden? or will they need to click it
Avatar of Jaziar

ASKER

Should the comment button also be a real button and not a action tag?
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 :-)

Avatar of Jaziar

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

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 Jaziar

ASKER

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!!
Oh, thank you for the points, grading and for the feedback :-)