snocross
asked on
Javascript Question
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?
Thanks!
-Snocross
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?
Thanks!
-Snocross
In the popup window use the window.opener.location object, like this
<input type=button onclick="window.opener.loc ation.repl ace('http://www.yahoo.com&field=1')">
and use query_string_decoded to capture the parameters.
~Hemanth
<input type=button onclick="window.opener.loc
and use query_string_decoded to capture the parameters.
~Hemanth
Sno,
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,
zvonko
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,
zvonko
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?
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?
ASKER
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.
Thanks
-Snocross
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.
Thanks
-Snocross
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([ViewRefreshField s]);
@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,
zvonko
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([ViewRefreshField
@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,
zvonko
ASKER
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.
-Snocross
-Snocross
oh ****!
So, domino2.wwow.com/Wwow is not your server?
So, domino2.wwow.com/Wwow is not your server?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
Thanks,
-Snocross
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.
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.
Thanks,
-Snocross
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].ListChos en;
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:
window.open('/bachwebworks /protips.n sf/Request OpenForm&k eyword='+e scape(val) +'&par2=xx ','Request ','locatio nbar=yes') ;
window.opener.location.hre f='/bachwe bworks/pro tips.nsf/R equest?Ope nForm&keyw ord='+esca pe(val)+'& par2=xx';
and here more options beside parameter 'locationbar=yes':
dependent=no
height=200
hotkeys=yes
innerHeight=200
innerWidth=200
locationbar=no
menubar=no
resizable=yes
screenX=100
screenY=30
status=yes
width=200
Good luck,
zvonko
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].ListChos
if (req.match(/&keyword=(.+)\
f1.value = unescape(RegExp.$1).split(
};
};
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:
window.open('/bachwebworks
window.opener.location.hre
and here more options beside parameter 'locationbar=yes':
dependent=no
height=200
hotkeys=yes
innerHeight=200
innerWidth=200
locationbar=no
menubar=no
resizable=yes
screenX=100
screenY=30
status=yes
width=200
Good luck,
zvonko
ASKER
Ok, I will hopefully try this tonight!
ASKER
Thanks so much for your help! It worked awesome.
Thank you Sno for the A and for the feedback <|;-)
ASKER
You're welcome, I appreciate your expertise... now, keep your eyes open for another question regarding this...
ASKER
http://www.bachmannwebworks.com/bachwebworks/protips.nsf/Document?Openform