For continued disscussion on this topic : Combining form entries from two windows
dragonz
08-07-2000, 09:50 PM
Here's the scenario:
1.Form on my main page gathers data
2.Popup window displays this data and generates subtotals or items off of main page
3.These subtotals are placed in hidden form fields on the popup window
4.Popup submit button has [onClick="opener.form.submit(); self.close()"]
5.The opener submit displays the submitted info on the original window and emails three people the data
Problem: In #5 none of the hidden values created in the popup window are pulled into the display nor the emails since they aren't part of the original form data.
Is there a way to have a submit of the main window data also include that generated in the popup?
I tried to opener.document.write the hidden values, however this didn't work. Since the asp server where the form runs is behind a firewall, I can't give you the URL to check it out.
I can paste code if it will help.
Thanks!
Vincent Puglia
08-07-2000, 11:05 PM
Hi dragonz,
what's wrong with:
<input type=hidden name=subtotal1 value=" (childwindow.document.formname.fieldname) ?childwindow.document.formname.fieldname.value : 0";>
If the above is no good, yea code would help :)
Vinny
dragonz
08-08-2000, 09:24 PM
Vincent,
I tried what you posted above, and either I put it in the wrong place or still am doing it wrong because the value still didn't come through.
I pulled a very basic copy of what I am doing off the IIS server and put it elsewhere so you can look. This server can't run the ASP file, but you can see the beginning code. I added part of the asp code in a comment at the bottom of the html document so you can see what it is creating.
http://www.geekess.net/worktemp/example.html
Once the user confirms their entries, the asp file takes the data, displays the "thank you" page, and sends out three emails with all the info.
How can I get the the subtotal1, subtotal2, subtotal3, and totalPrice data into the thank you page and email it spits out?
And a secondary question that came up while I was pulling this together. How can I get the values for subtotals and total to round off at two decimal places? Right now if a user puts in an item of 33 boxes at 8.45 it multiplies out to 12 or so decimal places. I know I can chop it off at the third place, but I want it to round not chop.
Thanks for your help, and please be patient with my long awkward code. :)
[Edited by dragonz on 08-08-2000 at 03:29 PM]
Arielladog
08-09-2000, 12:44 AM
Talk about long and awkward code :)
Anyway, this might help you.
When you are submitting the form, you are only submitting the stuff on that page. SInce the subtotals & total really isn't on that page, it isn't submitting anything. Here's my suggesstion:
have hidden fields for subtotal and total on the page. Then, when the form is submitted, have these hidden fields calculate the subtotal and total. THen, it should be submitted with the rest of the form.
Hope that helps, as I know nothing about ASP
-Asog :cool:
gzazJim
08-09-2000, 03:07 AM
Dragonz,
I will have a look at the code first thing in the morning and hopefully will have a simple solution by then - my brain's a bit addled at the moment!
Good luck until then,
Jim
Vincent Puglia
08-09-2000, 04:44 PM
Hi Jen,
Did you try sending the totals as hidden fields (as Arielladog suggests) or part of the action?
action="somename.asp?"sub1="+subtotal1+"&...."
Or as hidden fields?
<input type="hidden" name="subtotal1" value=subtotal1>
Vinny
(Jim: want me to transfer this out to the asp section?)
dragonz
08-09-2000, 05:03 PM
Vincent,
I put in the hidden form fields in the popup window generator. Which is not seen by the main window submit.
I tried putting the hidden form fields on the main html portion of my document, however it didn't pull the subtotal values from the popup window.
It could be I am using the wrong variable to pull the value in. Since both forms (original and popup submit) both have actions associated with them, I'm uncertain how adding a second action will work. For instance if I tell the popup submit to do the current submit & a function to assign values to the opener window would that work?
Not trying to be dense, just a beginner who can only spend a couple of hours a week trying to cram all this into my head. Thanks for trying to help me with this.
Vincent Puglia
08-09-2000, 05:59 PM
Hi Jen,
I downloaded it and will look at it later. In the meanwhile, the following thread discusses decimal points
http://www.webxpertz.net/forums/showthread.php?threadid=672
the script Arielladog is talking about is "Currency Formatter" at my site.
Also: is the user supposed to enter the unit price? Why??? I entered: 33,45 and 3.456 -- and they were accepted. You need to make sure people are entering valid input.
Vinny
gzazJim
08-09-2000, 07:29 PM
Vincent,
Probably a good idea... Move away, cause I don't know how to do that yet... It's been hectic today, so sorry for the slow responses.
Jim
Arielladog
08-09-2000, 07:36 PM
I'll move it as requested (it's the option down at the bottom under Admin options) :D
gzazJim
08-09-2000, 07:40 PM
Apparently I'd best open my eyes... Not enuff coffee yet I suppose...
Anyway, I'll have a look at the code and let you know what my thoughts are shortly! Thanks for the move Adog.
Jim
Vincent Puglia
08-10-2000, 05:14 AM
Hi Jen,
I played with it some this afternoon -- declaring the vars global in the original page, passing the arguments back to the original page, and a few other things -- I managed to get the vars to print with alerts(), but because I don't have my system set up for asp I can't tell if it would work. If you want I'll put up the changes, or you can wait until Jim fills up on coffee :)
Vinny
gzazJim
08-10-2000, 04:54 PM
Vincent,
For some reason, I'm unable to view dragonz' page from work here - if it's possible, could you possibly post the code you cut?
Thanks much,
Jim
dragonz
08-16-2000, 03:33 PM
I appreciate all the replies. I'm going to continue reading on how to do it, since I've been told now that it really isn't 100% necessary on the site.
It would be a nice add on, but they want me to put it into use now as is. If I stumble on it later I'll be sure to bug you all again.
Thanks!!
Powered by vBulletin® Version 4.1.12 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.