HII am really stuck with this particular part in my project. I am calling an agent from a javascript function. This agent does some validation and then open a new window with a button on it. I have to capture the click event of this button.
The problem i am facing is that the call to the agent is on click of a link which, after validation (f.submit)calls a servlet. Now i have to stop this from happening. The processing of the link shuld continue only after the user hits the ‘ok’ button on the window that has been opened by the agent. Currently this is not happening. The processing in the calling/parent window continues, as soon as the agent is called and the new window is opened, irrespective of the button being clicked or not.
Please help. I also want to know if we can access the Global variables that we set on the form under ‘Globals’ from an agent?
Thanks in advance. I really need this solved asap…
thnx again
Saili
Subject: RE: Accessing Global variables from an agent
I’m assuming this is a web application?
I think you’re probably mistaken about when the servlet is being invoked. If it’s in the same piece of JavaScript code that calls submit, then the request to the servlet is going off immediately after the form is submitted – it wouldn’t be sitting there waiting for the agent to finish running and answer the submit request. That being the case, there’s nothing you can do in the agent to prevent the request to run the servlet unless you have one of those BIT (Backwards in Time) chips in your server – and they’re new enough and expensive enough that I’m guessing you don’t.
The solution is to redesign the screen that your agent returns so that it invokes the servlet. I don’t understand exactly how your agent is putting up a window to the user in what is apparently a web application, so I can’t really give a more detailed answer. However, I suspect you will want to be passing around arguments on the URL, which the agent can read from the Query_String item in the context document.
No (to answer your other question) there’s no way that an agent can directly access global variables on a form. They don’t share the same variable space. You would have to store the information somewhere the agent can find it, or pass it in a parameter document (see NotesAgent.Run method) or on the URL as I described above, depeding how the agent is called.