[thelist] JavaScript: Passing form fields to popup NOT through URL

Brett Stinson bstinson at bscs.biz
Thu Jul 10 11:02:28 CDT 2003


Kyle:
  Try this....

<cfoutput>

<script type="text/javascript">
var popWin = window.open(paychecks_print.cfm, 'printCheck',
'toolbar=0,scrollbars=1');
popWin.document.printchecks.paychecks_print.checknums.value =
#allchecknumbers#;
popWin.document.printchecks.paychecks_print.payrollnums.value =
#allpayrollnumber#;
popWin.document.form.printchecks.target="printCheck";
popWin.document.form.printchecks.submit();
</script>



Brett Stinson
bstinson at programmer.net


-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org]On Behalf Of Kyle Murphy
Sent: Thursday, July 10, 2003 10:41 AM
To: Thelist at Lists. Evolt. Org
Subject: [thelist] JavaScript: Passing form fields to popup NOT through
URL


Here's my scenario.  I have a button on my page that opens up a popup window
& passes two URL variables (checknums & payrollnums).  Problem is, these
variables end up being too long for the 2,084 characters that IE allows in a
URL, so some get left off (or I get an error).

So, I need a way to pass those variables over to the popup, but not through
the URL.

I have been told to do the following through JavaScript:
1.) Open the popup window
2.) Set form variables in the opener
3.) Set form's target to popup
4.) Submit form.

I'm an amateur Javascript/DHTML writer, still, so I can't quite figure out
how to do this.  Here's what I tried in my opening page:

<cfoutput>

<script type="text/javascript">
window.open(paychecks_print.cfm, 'printCheck', 'toolbar=0,scrollbars=1');
document.printchecks.paychecks_print.checknums.value = #allchecknumbers#;
document.printchecks.paychecks_print.payrollnums.value = #allpayrollnumber#;
document.form.printchecks.target="printCheck";
document.form.printchecks.submit();
</script>

</cfoutput>

It doesn't work.  I get an "Object Not Found" JS error (as usual)!

How do I give the opening page a "name" or "id"?  Is that what 'printCheck'
is in the first line above?  I'm sorry I sound so stupid, but I can't seem
to figure this one out & I don't want to use session variables or anything
else to do this one-time passing of variables.

Thanks,
Kyle


--
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

Evolt.org conference in London, July 25-27 2003.  Register today at
http://evolt.org.uk

For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !




More information about the thelist mailing list