Click to See Complete Forum and Search --> : Need help passing loaded form variable in URL
knipper
05-30-2003, 08:07 AM
Hey Guys....
I have a form that uses javascript that grabs variables from the URL. The variables are then loaded into a database from hidden fields the submission of the form.
I also need to pass these same variables in a URL for a new window from a link on the page.
Can someone assist me on how to do this?
To clarify...I need to include the variables I grabbed from the URL into a new link on the page.
Thanks!
knipper
05-30-2003, 09:15 AM
To clarify a little more...
I am using several scripts on this page to do different things.
Primarily I pass variables in a url. I use one script to grab the variable.
Another script loads the variables into hidden form fields, which gets passed into a database.
The last script is to open a new window and submit the form. This is where I have the problem.
I can create a text link URL that grabs the loaded variables and writes the URL, but it won't work in the pop-up window.
Here's an example:
I can pass the variable in a text link like this:
<snip> code made window too long
But I need to get the URL to write in a window pop-up script that looks like this:
<snip> code made window too long
Help! :confused:
knipper
05-30-2003, 09:24 PM
Thanks Dave,
Thats the general idea, but I can't do it that way. I'm using a program called "phorm" to process the form.
Phorm actually controls the results... In my case it sends the info to a database, gives the customer a thank you for submitting page, and also e-mails the results to an e-mail box.
I'm trying to actually have two submit buttons, one that submits the form without the pop-up box, and one that submits the form and creates the pop-up box, passing some of the already gathered variables into the url of the popup.
I am almost there.... everything works EXCEPT the passing of the variable through to the popup box URL.
I can use one submit button to submit normally... works fine.(feeds database, shows page, and e-mails)
I can use the other submit button to a normal URL, works fine. (Pops up new window, shows thanks page, writes to the database, and e-mails)
BUT... I need to pass some of the variables through to the URL of the popup box.
If I can do this using some of the code you showed can you clarify? I can usually tweak code to make it do what I want, but don't know enough to write it myself. I know just enough to be dangerous! ;)
knipper
05-30-2003, 10:09 PM
Thanks again Dave,
I'll give that a shot in the AM. Time to end the day. 17 hours is plenty! :)
knipper
06-02-2003, 08:42 AM
Hey again Dave,
I still can't get the variables to pass. If you could take a look and send some additional suggestions I'd appreciate it. :)
OOoopppsss... You don't allow e-mail through the forum.
Take a look at this form (http://www.steveknipschild.com/phorm/javatest/survey2.htm?cust=DR00000001&invoice=123456&store=000&date=2003-06-02&salesperson=04&cashier=04) to see the whole picture.
Khalid Ali
06-02-2003, 08:46 AM
Do you mean you want to pass form values to another page using URL?
If so..take alooksy at this link..
http://68.145.35.86/skills/javascripts/DemoForwardFormDataViaURL.html
It might help
knipper
06-02-2003, 08:55 AM
Khalid,
Thats exactly what I need to do on the "first submit button" from my form. Take a look at the link I posted above and you'll see what I'm trying to do. :)
Can you shed some light on how to accomplish this?
Khalid Ali
06-02-2003, 09:00 AM
Sorry,but can you clearly describe what is it you need..if you want to pass a variable to a popup(a child) window,then there is a better way for doing this.you can use direct communication ..take a look at this link.
http://68.145.35.86/skills/javascripts/ParentWinInteractionWithChildWin.html
knipper
06-02-2003, 09:16 AM
Khalid,
I'll explain my whole scenario here:
1) I send a cust an e-mail to have them fill out my form. The link contains variables passed in the URL containing several items.
2) These variables get loaded into a single form which I need to offer two different types of submissions. (two different buttons)
3) Either submission passes the variables and other form data to a database, show the customer a thank you page, and e-mail the info.
PROBLEM: The first button uses javascript to open a new window in which I need to pass these same variables as before. It does already perform the same thing as step 2 above... I just can't get the variables to pass in the URL for the pop-up window.
If you view the source of the URL I posted before you will see how I have configured it to now.
Khalid Ali
06-02-2003, 09:31 AM
I guess if you insit on passing values using url to poup (first button ??)
then you will need to make changes in this function
function Start(page) {
OpenWin = this.open(page, "CtrlWindow", "toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes,width=660 height=300");
}
you will need to apend all of the variables with the link which is
page (parameter passed to Start function
You will need something like this to be done
page = page+"?variableName"+variable+"&variable2Name="+variable2;
and you can add several values just like that
make sure you have "?" mark right after the actual url and then you apend "&" to seaparate each variable value
knipper
06-02-2003, 10:14 AM
Ahhhh Hhhaaa!! That looks like it worked!
I'm sure there is probably a better way, but this thing (project) got cobbled together with input from several people after the initial form was created.
I'll post again if I have any other problems. Thanks to both you Khalid Ali and Dave Clark for your help and input.
Your assistance is invaluable! :D
Khalid Ali
06-02-2003, 10:16 AM
hey u are welcome..:D