Solved

CHALLENGE : passing value from lotus script agent to web form

Posted on 2003-12-12
4
854 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
Comment Utility
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
Comment Utility
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 Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This is an old article, please see an updated version of this article, located here: http://www.experts-exchange.com/articles/23619/Notes-8-5x-Windows-7-Notes-info-and-tips.html
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the fileā€¦
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now