We help IT Professionals succeed at work.

Javascript Question

snocross asked
Please see my example form and click 'Pick' above the first field.  A javascript window pops up.  You choose a word and press 'Create Request'.

What I would like to happen is from that point compose a new form and pass a value to the new form in the URL.  How can I pass the selected value to the URL in the new window?


Watch Question

In the popup window use the window.opener.location object, like this

<input type=button onclick="window.opener.location.replace('http://www.yahoo.com&field=1')">

and use query_string_decoded to capture the parameters.



can you please run catalog task on domino2.wwow.com/Wwow so I can see actual db settings <|;-)

Please zip and send me your bachwebworks/protips.nsf to: zp@worldonline.de
(or send me only your email, so I can contact you)

So long,

allow me to repeat your question Sno;

you would like, when the user presses the button: [CreateRequest]
on the "ChooseKeyword" form, than it should not call the JavaScript function "addToList", but close the "ChooseKeyword" form and open a newone form (lets name it "RequestForm") and pass to this requestform the value user picked up in "ChooseKeyword" form.

Is this correct so far?

...untill now "addToList" writes back to the parent calling "Document" form the selected value (by JavaScript methods); so why do you like to open a third (the "RequestForm") form?


Heman, I will have to look into that.

Yes Zvonko, that's exactly what I want to do.

The reason I want to open a third is because what I'm trying to do is have a QueryOpen agent fill in the values on the 3rd document based on a key that is passed in the URL.  If I pass the value back to the original form, the QueryOpen agent does not get executed.  So I'm eventually going to skip the first document and go right to the ChooseKeyword form, pick a value, then create the new form and populate the values.



OK Sno,

you do not need any WebQueryOpen agent to get an agent executed to refesh or recalculate the form.

So, how about this scenario:

1.) User opens "Document" form.
2.) User clicks on "Pick" link.
3.) In a new window opens  the "ChooseKeyword" form.
4.) User selects in this form the keyword and press [Enter] key or a [Request] button.
5.) As an action in this  "ChooseKeyword" form runs a JavaScript function.
6.) JavaScript function copies the keyword to the receiver field in "Document" form.
7.) The JavaScript function trigers a button on the "Document" form. Behind the button is an agent.
(and here comes the supertrooper trick!!! this button has not even to be visible on the form. Below is the description how to ahive this)
8.) The agent does the form recalculation and request creation.
9.) The above JavaScript function closes the "ChooseKeyword" form.

And here how to make this button to triger the agent and be invisible:
1.) Create a subform containing only one button with this two formulas:
@Command([ToolsRunMacro]; "CheckAndMakeRequest")
2.) Insert this subform at first position into "Document" form.
3.) Open the "Document" form in web browser and save the HTML source code as text.
4.) In this HTML code is a JavaScript action to triger the button (you need it).
5) Remove the subform from the "Document" form.

And here comes the supertrooper trick: the JavaScript button triger code can now be used from any JavaScript function or html event call. Even better: you can now use this line of code on forms that never have pasted this subform. You only are not allowed to edit the subform, but replication of the subform design is not a problem.

I have used this trick in R5, but I assume that R4.6 has to work the same (I have not checked this).

...and do not forget to increase the points for this question to max and give me an A <|;-)

If you have problems implementhing this, I will try to support you.

Good luck,


That sounds very cool but my client does not want to see the form at all until the user has chosen a value from the "ChooseKeyword" form.  He wants to start from FORM A, click a button that presents the "ChooseKeyword" form B, and then is brought to a NEW form C.  He doesn't care about FORM A.


oh ****!
So, domino2.wwow.com/Wwow is not your server?
...but I still think I get this 300 points multiple A <|;-)

'cose Heman proposal is good, but here comes a better one...

ok, to keep the explanation simple I use the same forms as you already have:
"Document", "ChooseKeyword" and a copy of "Document" named "Request"

So, "Document" stay the same as is.
"ChooseKeyword" get changed the JavaScript function "addToList(val)". Here the new version:
function addToList(val){
   if (cho.selectedIndex==-1){return false};
   sel.value = val;
   window.status=val + ' added to top of the list....';
(the only change is this new window.open line)

And into form "Request" (a copy of "Document") you have to add this parts:
Into <BODY> tag you have to add an onLoad event call, like this:
<BODY TEXT="000000" BGCOLOR="82c0ff" link=brown  onLoad="setFields()">
and where the best is for you, add this new JavaScript function setFields():
<Script Language=JavaScript>
function setFields() {
  req = window.location.href;
  field = document.forms[0].ListChosen;
  if (req.match(/&keyword=(.+);/i)) {
    field.value = unescape(RegExp.$1);

If the <BODY> manipulation is a problem in R4.6, than simple make this call at the end of the form (before </BODY> tag). Like this:
<Script Language=JavaScript>setFields()</Script>

Anycase I think this code is 300 pennies worth ;-)


Yes, domino2.wwow.com is my server.

Ok, that looks like what I need... just one question... when the request form opens in a new window will the address bar etc be visible (you know where you type the URL in)?  Just wondering because I noticed on the "ChooseKeyword" window there is no address bar and no BACK button etc.  This is perfect for the "ChooseKeyword" form because it's supposed to simulate a dialog box but I need the Request form to look like a normal browser session.



PS:  Why don't you have EE combine your STAMP points with your ZVONKO points?  Seems you have worked to hard to lose all those points.

Sno do not ask; I have tried and tried, but got no expert points transfered to my new account.

But for your new window problem I have two improvements.
First is an improved setFields() function:
function setFields() {
 var req = window.location.href+'&';
 var f1 = document.forms[0].ListChosen;
 if (req.match(/&keyword=(.+)\&/i)) {
   f1.value = unescape(RegExp.$1).split('&')[0];

second improvement is in this "ChooseKeyword" form; either give window.open parameter to get LocationBar opened (does not work :-), or open the "Request" form in the parent window where "Document" was open. Here the javascript for this two options in addToList() function:

and here more options beside parameter 'locationbar=yes':

Good luck,


Ok, I will hopefully try this tonight!


Thanks so much for your help!  It worked awesome.

Thank you Sno for the A and for the feedback <|;-)


You're welcome, I appreciate your expertise... now, keep your eyes open for another question regarding this...

Explore More ContentExplore courses, solutions, and other research materials related to this topic.