?
Solved

Assigning a Value to a field in JavaScript

Posted on 2004-11-11
21
Medium Priority
?
258 Views
Last Modified: 2013-12-18
I want to update a field (DellPurchStatus) to approved - here is what I have today.  This code works, I just need to add

DellPurchStatus = Approved somewhere.

cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Accept Comment</title></head>'+
'<body><form><h3>Please Enter Any Comments Regarding Acceptence</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].DellPurchCom.value =document.forms[0].counterText.value;opener.document.forms[0].RefreshButton.onclick();self.close()"'+
">"+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');

0
Comment
Question by:Jaziar
21 Comments
 
LVL 14

Expert Comment

by:p_partha
ID: 12555145
I am assuming dellpurchstatus to be in the parent window...

cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Accept Comment</title></head>'+
'<body><form><h3>Please Enter Any Comments Regarding Acceptence</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].DellPurchCom.value =document.forms[0].counterText.value;opener.document.forms[0].RefreshButton.onclick();opener.document.forms[0].DellPurchStatus="approved";self.close()"'+
">"+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');
0
 
LVL 14

Accepted Solution

by:
p_partha earned 800 total points
ID: 12555152
sorry a typo:
I am assuming dellpurchstatus to be in the parent window...

cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Accept Comment</title></head>'+
'<body><form><h3>Please Enter Any Comments Regarding Acceptence</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].DellPurchCom.value =document.forms[0].counterText.value;opener.document.forms[0].RefreshButton.onclick();opener.document.forms[0].DellPurchStatus.value="Approved";self.close()"'+
">"+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');
0
 

Author Comment

by:Jaziar
ID: 12555343
I am still getting error on page

opener.documents.forms.0.DellPurchStatus is null or not and object
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 14

Expert Comment

by:p_partha
ID: 12555349
Is DellPurchStatus field available in the main window or not, If yes then check the spelling

partha
0
 

Author Comment

by:Jaziar
ID: 12557113
The DellPurchStatus is on the main form - the same form the action button is on.  It is a computed field with the default value of DellPurchStatus
0
 

Author Comment

by:Jaziar
ID: 12557502
I am starting to think there is something wrong with the database.  Even though I completely remove any refrence to the field including deleting the field.  Saving and rebooting my PC.  When I run the new script without DellPurchStatus in it.  I get the same error the that field is null.  Strange Indeed
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 100 total points
ID: 12557789
The error is because as far as the browser is concerned, it is not a field.  Domino generates any editable fields as browser-recognized fields.  But any computed/computed for display fields are not generated -- being computed, they just display the text of the computation, which makes sense (think about it).

There is an option to override this behavior, called "generate HTML for all fields," on the second tab of form properties.  I do not like this opton, beause it can have unintended side effects.  There are other workarounds, but you might want to try this one first, even though I don't liek it particularly.
0
 

Author Comment

by:Jaziar
ID: 12557950
After the change to Generate HMTL

I get the error "Approved" is undefined
0
 
LVL 46

Assisted Solution

by:Sjef Bosman
Sjef Bosman earned 100 total points
ID: 12564172
sorry another typo:

cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Accept Comment</title></head>'+
'<body><form><h3>Please Enter Any Comments Regarding Acceptence</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].DellPurchCom.value =document.forms[0].counterText.value;opener.document.forms[0].RefreshButton.onclick();opener.document.forms[0].DellPurchStatus.value=\"Approved\";self.close()"'+
">"+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');

You have to escape the quotes around the word Approved
0
 

Author Comment

by:Jaziar
ID: 12586525
Now when I click the OK button it does nothing it just freezes.  I can then hit cancel and it removes the box.  I am getting no errors messages or anything.  Just sits there on screen

Taking points to 200

Not sure why this simple javascript is causing me so many headaches????
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12586681
What are you doing on Refreshbutton ?.. try this then:

cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Accept Comment</title></head>'+
'<body><form><h3>Please Enter Any Comments Regarding Acceptence</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].DellPurchCom.value =document.forms[0].counterText.value;opener.document.forms[0].DellPurchStatus.value=\"Approved\";opener.document.forms[0].RefreshButton.onclick();self.close()"'+
">"+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');
0
 

Author Comment

by:Jaziar
ID: 12587305
WHen I go into the browser (web client)  I can not see any changes made to the javascript -

example

'<body><form><h3>Please Enter Any Comments Regarding Acceptence</h3>'+

I changed to
'<body><form><h3>Hello World</h3>'+

I saved, opened the browser and hit the action button and it still says

Please Enter Any Comments R........

It seems not to get the updated JavaScript

0
 
LVL 14

Expert Comment

by:p_partha
ID: 12587321
It's coming from the cache.. Do one thing clear your browser cache...

Partha
0
 

Author Comment

by:Jaziar
ID: 12587360
Ok I will try to clear the cache and try again
0
 

Author Comment

by:Jaziar
ID: 12587461
I cleared the Cache and that did not help.  I tried the same form in FireFox.  FireFox has a status bar on the bottom of the dialog box.  THe status goes about 3/4 quarters they and stops.  It really seems like the script is freezing somewhere
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12587473
In firefox go to tools --> javascript console and paste what is the error that is reported..

Partha
0
 

Author Comment

by:Jaziar
ID: 12587554
Error: syntax error
Source Code:
opener.document.forms[0].DellPurchCom.value =document.forms[0].counterText.value;opener.document.forms[0].RefreshButton.onclick();opener.document.forms[0].DellPchStatus.value=
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12588177
it's getting complicated. Just do one thing, Your old code was working right, just add this line in the refreshbutton.click() before all teh lines:

document.forms[0].DellPurchStatus.value="approved"
0
 

Author Comment

by:Jaziar
ID: 12593154
Good Morning!

I have set the code back to the start

cw=window.open('','','height=150,width=300,status');
cw.moveTo(200,200);
cw.document.write('<html><head><title>Add Accept Comment</title></head>'+
'<body><form><h3>Please Enter Any Comments Regarding Acceptence</h3>'+
'<textarea name=counterText rows=2 cols=30></textarea>'+
'<input type=button value=OK '+
'onClick="opener.document.forms[0].DellPurchCom.value =document.forms[0].counterText.value;opener.document.forms[0].RefreshButton.onclick();self.close()"'+
">"+
'<input type=button value=Cancel '+
'onClick="window.close()">'+
'</form></body></html>');


This code works, I have tested it.  All is needed is the approval stamp in field DellPurchStatus.

When I add -> document.forms[0].DellPurchStatus.value="approved" (It stops working, I have also tried /"Approved/")

I was unable to test your latest suggestion Partha, due to I am not sure where to put the line
0
 
LVL 14

Expert Comment

by:p_partha
ID: 12593508
Can you paste what is in RefreshButton

Partha
0
 

Author Comment

by:Jaziar
ID: 12593654
I resovled the problem by creating a text field on the form and setting it equal to approve.  Then just making the new field equal to that field with the static text.  I know it is not the correct way but it works.  I would like to say thanks to everyone that stayed with me on this on.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
This article covers general Notes 8.5 troubleshooting information including recreating the Notes\Data folder.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question