473,385 Members | 1,944 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

get dynamic formname and return value to opener

Hi,

I have 6 forms being generated using coldFusion, they are named
special1, special2 special3 and so on.. in these forms I have a link to
open a new window.

I am trying to pickup the formname passed along to the new window.. the
window opener function is:

<SCRIPT LANGUAGE = "JavaScript">
<!--

function newupload()
{

var
newWind=window.open(imageupload.cfm,'remote','widt h=450,height=430,scrollbars=yes,status=yes');
if (newWind.opener == null)
{ newWind.opener = window; }

}

//-->
</SCRIPT>

the caller: <A HREF = "javascript:newupload('#formname#',
'special_image')">Upload New Image</A>

... this is working, then in the new window after some processing I want
to return a value to the opener..

this is what I need but I dont know how to get it..

window.opener.document."Formname".value

after looking around this is what I've been trying
<SCRIPT LANGUAGE="JavaScript">
<!--
function setimagename(iName)
{

var argstr = location.search.substring(1, location.search.length)
var args = argstr.split('?');
var ci = unescape(args[0]);
document.write(ci); // prints it in the HTML

/*opener.document.Special1.special_image.value=iNam e;*/

/*close();*/

}
//-->
</SCRIPT>
but it doesn't work.. no error just doesn't work (using ie 6)
Any Ideas welcome..
Dave

Feb 2 '06 #1
5 3132
Hello Dave,

Can you give an HTML version of the page, it would be easier to assist if
the problem is seen.

--
Elias
<dr****@canoemail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,

I have 6 forms being generated using coldFusion, they are named
special1, special2 special3 and so on.. in these forms I have a link to
open a new window.

I am trying to pickup the formname passed along to the new window.. the
window opener function is:

<SCRIPT LANGUAGE = "JavaScript">
<!--

function newupload()
{

var
newWind=window.open(imageupload.cfm,'remote','widt h=450,height=430,scrollbars=yes,status=yes');
if (newWind.opener == null)
{ newWind.opener = window; }

}

//-->
</SCRIPT>

the caller: <A HREF = "javascript:newupload('#formname#',
'special_image')">Upload New Image</A>

.. this is working, then in the new window after some processing I want
to return a value to the opener..

this is what I need but I dont know how to get it..

window.opener.document."Formname".value

after looking around this is what I've been trying
<SCRIPT LANGUAGE="JavaScript">
<!--
function setimagename(iName)
{

var argstr = location.search.substring(1, location.search.length)
var args = argstr.split('?');
var ci = unescape(args[0]);
document.write(ci); // prints it in the HTML

/*opener.document.Special1.special_image.value=iNam e;*/

/*close();*/

}
//-->
</SCRIPT>
but it doesn't work.. no error just doesn't work (using ie 6)
Any Ideas welcome..
Dave

Feb 2 '06 #2
dr****@canoemail.com wrote:
Hi,

I have 6 forms being generated using coldFusion, they are named
special1, special2 special3 and so on.. in these forms I have a link to
open a new window.

I am trying to pickup the formname passed along to the new window.. the
window opener function is:

<SCRIPT LANGUAGE = "JavaScript">
<!--

function newupload()
{

var
newWind=window.open(imageupload.cfm,'remote','widt h=450,height=430,scrollbars=yes,status=yes');
if (newWind.opener == null)
{ newWind.opener = window; }

}

//-->
</SCRIPT>

the caller: <A HREF = "javascript:newupload('#formname#',
'special_image')">Upload New Image</A>

.. this is working, then in the new window after some processing I want
to return a value to the opener..

this is what I need but I dont know how to get it..

window.opener.document."Formname".value
function getFormNamesFromOpener(){
var f=window.opener.document.forms,ff=f.length,ARR=[];
while(ff--) {ARR.push(f[ff].name}
return ARR;
}
alert(getFormNamesFromOpener().join("/");


after looking around this is what I've been trying
<SCRIPT LANGUAGE="JavaScript">
<!--
function setimagename(iName)
{

var argstr = location.search.substring(1, location.search.length)
var args = argstr.split('?');
var ci = unescape(args[0]);
document.write(ci); // prints it in the HTML
I don't know what you're trying to do here but the following is equivalent:

function setimagename(iName){
document.write(unescape(location.search.substring( 1));
}

Mick

/*opener.document.Special1.special_image.value=iNam e;*/

/*close();*/

}
//-->
</SCRIPT>
but it doesn't work.. no error just doesn't work (using ie 6)
Any Ideas welcome..
Dave

Feb 2 '06 #3
sorry about the size but here is the page with the forms.. only 2 in
this example.. I'm trying to pass the formname in the urlstring to try
and acess..

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Tyendinaga Computers - Virtual Office</title>
<link rel="STYLESHEET" type="text/css" href="../tc.css">

<SCRIPT LANGUAGE = "JavaScript">
<!--

// 'imageupload.cfm?form='function to load the upload window.
function newupload()
{

theURL = "imageupload.cfm?id=" + special1;
var
newWind=window.open(theURL,'remote','width=450,hei ght=430,scrollbars=yes,status=yes');
if (newWind.opener == null)
{ newWind.opener = window; }

}

//-->
</SCRIPT>
</head>

<body bgcolor="#ffffff" leftmargin="0" marginwidth="0" rightmargin="0">
<table cellpadding="0" cellspacing="0" border="1" width="100%">
<tr>
<td align="center"><img src="images/logo.gif" width="329" height="64"
alt="" border="0"><br><img src="images/spacer.gif" width="1"
height="10" alt="" border="0"></td>
</tr>
<tr>
<td background="images/bg_blue.gif"><img src="images/spacer.gif"
width="1" height="1" alt="" border="0"></td>
</tr>
<tr>
<td background="images/bg_red.gif"><img src="images/spacer.gif"
width="10" height="1" alt="" border="0"><img src="images/vo.gif"
width="157" height="31" alt="" border="0"></td>
</tr>
<tr>
<td bgcolor="#ffffff"><img src="images/spacer.gif" width="1"
height="1" alt="" border="0"></td>
</tr>
<tr>
<td background="images/bg_blue.gif" height="350" valign="top"><img
src="images/spacer.gif" width="1" height="1" alt="" border="0"><br>
<p>&nbsp;&nbsp;&nbsp;&nbsp;<a href="index.htm" class="vo">Main Menu</a>
<table cellpadding="3" cellspacing="0" border="0" align="center">
<tr>
<td class="vohdr" colspan="2">Edit Specials<br><br></td>
</tr>
<tr>
<td colspan="2" class="vohdr"><b>Information Below will appear on
the <a href="../comp_special.cfm" class="vohdr">Specials
Page</a></b></td>
</tr>
<tr>
<td bgcolor="#F7F3F3" width="600"><br>

<form name="special1" action="updateSpecials.cfm"
method="post">
<table width="600" cellpadding="3" cellspacing="0"
border="1">


<input type="hidden" name="id" value="1">
<tr>
<td class="text">Visible on Page:</td>
<td class="text"><input type="checkbox" name="special_visible"
</td>

</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Title:</td>
<td><input type="text" name="special_title"
value="IBM Refurbished Desktops" class="input"></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Price:</td>
<td><input type="text" name="special_price"
value="550.50" class=".dollarinput"></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Extra Price Info:</td>
<td><input type="text" name="extra_label"
value="$429.00 without monitor" class="input"></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Includes:</td>
<td><input type="text" name="includes" value="Add
Corel WP Office Suite & MacAfee Antivirus for $29.00"
class="input"></td>
</tr>

<tr>
<td class="text" valign="top" align="right">Special
Offer Details List:</td>
<td><textarea name="special_details" cols="20"
rows="10" wrap="virtual" class="comments2"><li>IBM P4, 2.0GHz
<li>256MB RAM
<li>40GB/FDD
<li>New CDRW
<li>Keyboard
<li>Mouse & Speakers
<li>10/100 NIC
<li>New 17" Monitor
<li>Windows 2000 Professional
<li>Test item</textarea></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Image Name </td>
<td><input type="text" name="special_image"
value="empty.jpg">&nbsp;<A HREF = "javascript:newupload('special1',
'special_image')">Upload New Image</A></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit"
name="btn" value="Update"></td>
</tr>

</table>
</form>
<p></p>

<form name="special2" action="updateSpecials.cfm"
method="post">
<table width="600" cellpadding="3" cellspacing="0"
border="1">


<input type="hidden" name="id" value="2">
<tr>
<td class="text">Visible on Page:</td>
<td class="text"><input type="checkbox" name="special_visible"
checked></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Title:</td>
<td><input type="text" name="special_title"
value="Lexmark Z615" class="input"></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Price:</td>
<td><input type="text" name="special_price"
value="49.00" class=".dollarinput"></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Extra Price Info:</td>
<td><input type="text" name="extra_label" value=""
class="input"></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Includes:</td>
<td><input type="text" name="includes" value="Factory
Refurbished Printer" class="input"></td>
</tr>

<tr>
<td class="text" valign="top" align="right">Special
Offer Details List:</td>
<td><textarea name="special_details" cols="20"
rows="10" wrap="virtual" class="comments2"><li>Black & colour
cartridges
<li>1 year manufacturers warranty
</textarea></td>
</tr>
<tr>
<td class="text" valign="top" width="150"
align="right">Image Name </td>
<td><input type="text" name="special_image"
value="z615.jpg">&nbsp;<A HREF = "javascript:newupload('special2',
'special_image')">Upload New Image</A></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit"
name="btn" value="Update"></td>
</tr>

</table>
</form>
<p></p>

</table><br><br></td>
</tr>
</table>
</body>
</html>

Feb 2 '06 #4
Hi Mick,

Thx for the reply, 1 more thing

what I need to do is really get this line..

opener.document.Special1.special_image.value=iName ;

when I hardcode that it returns the proper value to the opener, how
would i use your function to get the value in there..

I tried this.. but got an error

<SCRIPT LANGUAGE="JavaScript">
<!--

function getFormNamesFromOpener(){
var f=window.opener.document.forms,ff=f.length,ARR=[];
while(ff--) {ARR.push(f[ff].name}
return ARR;

}

function setimagename(iName)
{

opener.document.getFormNamesFromOpener().special_i mage.value=iName;

/*close();*/

}
//-->
</SCRIPT>

Feb 2 '06 #5
dr****@canoemail.com wrote:
Hi Mick,

Thx for the reply, 1 more thing

what I need to do is really get this line..

opener.document.Special1.special_image.value=iName ;

when I hardcode that it returns the proper value to the opener, how
would i use your function to get the value in there..

I tried this.. but got an error

<SCRIPT LANGUAGE="JavaScript">
<!--

function getFormNamesFromOpener(){
var f=window.opener.document.forms,ff=f.length,ARR=[];
while(ff--) {ARR.push(f[ff].name}
return ARR;

}

function setimagename(iName)
{

opener.document.getFormNamesFromOpener().special_i mage.value=iName;

opener.document.forms[getFormNamesFromOpener()[0]].special_image.value=iName;

or simply:

opener.document.forms[0].special_image.value=iName;

Mick

/*close();*/

}
//-->
</SCRIPT>

Feb 2 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: D Mineer | last post by:
HEre is my code function passVal(p,q,r){ with (window.opener.form1) { bldr_cmpny.value=p bldr_cotel.value=q; bldr_lcse.value=r; } window.close(); }
4
by: cwwilly | last post by:
Hello, Thanks for taking a look at this! Problem: I'm trying to pass multiple dynamic values between a slaveform and a masterform. The problem I'm having is on the slaveform I loop through...
4
by: Pasquale | last post by:
Hello, I wondering if there is a way to dynamically update a select list with javascript from a database query without having to reload the page to update the list?
1
by: Piotr | last post by:
I have popup window (window.open) where I put any value in input field. After submit I wan to to return to the main window and get value from popup window. How to close popup window and return to...
7
by: michael | last post by:
apologies in advance, as not only am i new to learning how to code javascript properly, i'm new to the groups posting thing... i am developing in firefox 1.0+, but will be working in an msie 6.0+...
4
by: JV | last post by:
I thought I once saw somewhere that a global variable, "xyz" for example, could be declared and used so that instead of using "document.formname.elementname.value" one could use...
2
by: thuythu | last post by:
Please help me.... I used and Javascript to view the data. But when i click button open a popup windows, then select data and click save button. The popup close and return the main page, but the...
4
by: Michael Munch | last post by:
Hi I want to read the value of af text-field, create dynamic, in a form. Se below a small test-site to do that (but readning fails): I use the function Test_Read for reading the value from the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.