Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

CHALLENGE : passing value from lotus script agent to web form

Posted on 2003-12-12
4
858 Views
Last Modified: 2013-12-18
i have aweb form,on the click of a button on it , a lotus script agent call , this agent also have java script code. alert message in JS is working fine but when i assign some string variable to field on form through java script , it show the message "document.forms[0] has no properties".

code:

Print | <SCRIPT LANGUAGE=""JavaScript"">{document.forms[0].textfield.value="fill this"; |
      Print | alert("this is alert"); |
      Print | history.back();}</SCRIPT>|

IT WOULD BE GREAT HELP !
0
Comment
Question by:arvindmalik
4 Comments
 
LVL 15

Accepted Solution

by:
Bozzie4 earned 25 total points
ID: 9928404
well, yeah, that's normal, because you create a new html page in your agent.

Print | <SCRIPT LANGUAGE=""JavaScript"">{document.forms[0].textfield.value="fill this"; |
     Print | alert("this is alert"); |
     Print | history.back();}</SCRIPT>|

is really

Print | <html><body><SCRIPT LANGUAGE=""JavaScript"">{document.forms[0].textfield.value="fill this"; |
     Print | alert("this is alert"); |
     Print | history.back();}</SCRIPT></body></html>|

If you want to get data back to the original document/form/page, you'll need to do this slightly different.

What you could do:
create a button in javascript, that doesn't directly calls the agent, but opens a new document (use openwindow javascript method).  Now open a form, where you have your agent as QueryOpen agent.  You can now write back to the original document using the opener (or parent, I'm not sure) property of the currently opened window.
Writing back would look like opener.document.forms[0].textfield.value

Of course, this means you must completely rewrite your agent.  There are of course , other ways to get data back from your agent in the document you were working...

cheers,

Tom
0
 
LVL 31

Assisted Solution

by:qwaletee
qwaletee earned 25 total points
ID: 9928709
Hi arvindmalik,

If you are trying to retrieve data from the existing form when the agent is called, you cant do it the way you are describing Domino web applications are similar to client/server programs (or like n-tier systems) You are mixing up the "client" portion and the "server" portion The client portion is the browser where the form DISPLAYS and where JavaScript executes. The server portion is what processes the submitted data and runs the agents, retrieves additional data and creates HTML for the client to use.  What ties it together is the HTML file that DOmno dynamically generates and sends to the client so it knows what to display and knows what JavaScript to use, plus the browser's ability to take URLs and request them or take forms and send their data back.

The print statements in an agent create HTML for the browser to interpret, but the browser sees the HTML as a new page, which it usually has no way of relating to the old data in the prior page (which had the form).  The agent does not have the form either, it only knows thatit was called somehow, which happens to be in the context of a request from teh web browser.  You either had a [ToolsRunMacro] command to run the agent, or you created a URL directly to it, or you implicitly ran the agent via WebQueryOpen or WebQuerySave.  Note that in a WebQueryOpen, the print statements have no effect, as the form generates the HTML, not the agent.

A) So, if you were trying to have the agent add additinal JavaScript to a form as the form opens, you can't do it with print statements.  That would either be done "natively" on the form (pass through HTML or the JavaScript coding areas of the form), or you could have an agent ggenerate JavaScript that gets placed in a read-only field marked as pass through HTML.

B) If you inteded the agent to change some data on the form when it is subitted, then you shoudl be manipulating the document before it is saved to the database.

C) If you are trying to have the agent manipulate the form that teh user is seeing -- user loads form, makes changes, does something to cause the agent to run, and see the form again with changed data,butit has not been saved yet -- then you are probably using the wrong approach.  You want that to happen via the methods in (A) above.  This is possible to do via the server, but much more complex.


Best regards,
qwaletee
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need a tweak in Column code (in Notes view) 5 62
Add a cc field to email code 6 100
Lotus Notes transfer mail box problem 6 106
Lotus Notes – Domino Document Manager 4 115
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…
Notes Document Link used by IBM Notes is a link file which aids in the sharing of links to documents in email and webpages. The posts describe the importance and steps to create a Lotus Notes NDL file in brief.
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 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