This is a follow-up to a previous post. I have a $$ViewTemplate with a form action which runs a LotusScript library. The intent is for the LotusScript Library to open a child window if certain criteria are met. Below is my understanding of a solution that was suggested on how to open the child window under this scenario.
1.) Use pass through HTML as follows to create an iframe on the $$ViewTemplate. Add this after the closing tag, but before
the closing tag.
2.) Add a button (‘ChildWindowButton’) to the $$ViewTemplate. In the ‘onClick event’, set 'src=“http://Host/Database/agentName?OpenAgent” '. Hide the button and convert it to HTML.
3.) Add the following to the LotusScript library:
Print “”
Print “document.forms[1].ChildWindowButton.click();”
Print “”
In item 2, it’s still not apparent to me what the syntax should be so that ‘src’ is associated with the iframe and the opener is identified so that values can be passed back from the child.
I’d appreciate any ideas on this. Thanks.
Subject: Opening a Child Window with JavaScript
Can you leave the LotusScript alone for a bit? Please? The
The button onclick should be:
“document.frames[‘frameName’].src = ‘agentName?OpenAgent&OptionalParm=Optional+Value’;”
That will call your agent into the iframe. NOW you can play with LotusScript to your heart’s content. Have the agent print back a simple HTML page that opens a child window with the appropriate parameters from its onload event. (This assumes that an agent is needed at all.)
Subject: RE: Opening a Child Window with JavaScript
Here’s what I’m not following …
Something needs to trigger the ‘onClick’ of the added button. The logical trigger would seem to be the form action that runs the LotusScript Library because it is here in which the logic determines whether the child window should be displayed. Accordingly, I’ve added the following to the LotusScript Library:
Print “”
The result is that only a white screen appears. If however, “This is a test” did appear, I would have expected that adding the following code to the agent would open a child window and properly identify the opener. (This is the came code that opened the child window when it ran in the LotusScript Library. The problem with that however was that it could not identify the opener.)
Dim url As String
Print “”
If there’s anything else that I might be overlooking, please let me know. Thanks.
Subject: RE: Opening a Child Window with JavaScript
Yeah – the user clicking a button would trigger its onlick. If you want the dialog to come up EVERY time the view is opened, then hard-code the pop-up or hard-code the agent’s URL into the
Subject: RE: Opening a Child Window with JavaScript
The button ‘onClick’ is not being recognized even if the button is clicked manually rather than invoked by LotusScript. The result is that a white screen appears.
The onClick code is as follows:
If the URL in the button code is copied and pasted into a browser, it runs an Alert statement in the iframe agent. (The message ‘This is a test.’ appears.)
The iframe is defined on the $$ViewTemplate as follows:
The agent is set as ‘Agent list selection’ with a target of ‘None’.
I’d appreciate any ideas on why the button ‘onClick’ event is not being recognized. Thanks.
Subject: RE: Opening a Child Window with JavaScript
Sorry, dude – add return false to the onclick or it will act as a submit button if it’s the only button on the page:
Subject: RE: Opening a Child Window with JavaScript
Adding ‘return false’ has not made any difference - there is still no response when the button is clicked. I’m beginning to wonder whether this particular solution isn’t feasible because of how the $$ViewTemplate is being used. In other words, the button hasn’t been added to a standard form, but rather to the second form on a $$ViewTemplate (below the tag) as part of the CodeStore.com solution for processing selected documents.
I’d appreciate any other ideas on why the button ‘onClick’ event might not be responding. Thanks.
Subject: RE: Opening a Child Window with JavaScript
Mail it to me – there is no particular reason why the button as described shouldn’t be working, so there’s obviously something being lost in the translation.
Subject: RE: Opening a Child Window with JavaScript
Resolved using .getElementsById() instead of .frames.