?
Solved

CHALLENGE : passing value from lotus script agent to web form

Posted on 2003-12-12
4
Medium Priority
?
866 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
[X]
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
4 Comments
 
LVL 15

Accepted Solution

by:
Bozzie4 earned 100 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 100 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month15 days, 4 hours left to enroll

770 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