473,396 Members | 1,892 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,396 software developers and data experts.

modal form javascript can't find server control in opener to paste

I have a web form “Form1” with a panel. Inside the panel is a datalist. One
of the items displays the field value “xyz” from the dataset. If the field
is null the user clicks on a javascript to let him pick a value for the field
from a popup modal window.

<td><a href="javascript:GetNet()"> <img src="”> </a>VPN Network:</td>

<% if (XYZ !=""){%>
<td><asp:TextBox id="txtXYZ" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "XYZ") %>'></asp:TextBox>
<%}else{%>
<input type="text" runat=server id="XYZ">
<%}%></td>

The javascript on modal form tries to put a value selected back into
form1.XYZ with

function pasteNet(lstr)
{
window.opener.document.forms["Form1"].elements["XYZ"].value = lstr;
window.close();
}
I get the error

Microsoft JScript runtime error:
'window.opener.document.forms.Form1.elements.vpnne t' is null or not an object

Is the syntax for identifying the server control input box incorrect? Does
it have to do with the input box being nested in the “if statement”. If I
use an html input box it works fine, the problem I need to attach code to the
input box so server control.

Please help
cindy
Nov 19 '05 #1
3 5383
Cindy,

I like using document.getElementById('[ElementName]') to find page items via
javascript.

Try:

function pasteNet(lstr)
{
window.opener.document.getElementById('XYZ').value = lstr;
window.close();
}

If that doesn't work you may need to check how you're referring to
window.opener.
--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"cindy" <cm****@nospam.nospam> wrote in message
news:86**********************************@microsof t.com...
I have a web form "Form1" with a panel. Inside the panel is a datalist.
One
of the items displays the field value "xyz" from the dataset. If the
field
is null the user clicks on a javascript to let him pick a value for the
field
from a popup modal window.

<td><a href="javascript:GetNet()"> <img src=""> </a>VPN Network:</td>

<% if (XYZ !=""){%>
<td><asp:TextBox id="txtXYZ" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "XYZ") %>'></asp:TextBox>
<%}else{%>
<input type="text" runat=server id="XYZ">
<%}%></td>

The javascript on modal form tries to put a value selected back into
form1.XYZ with

function pasteNet(lstr)
{
window.opener.document.forms["Form1"].elements["XYZ"].value = lstr;
window.close();
}
I get the error

Microsoft JScript runtime error:
'window.opener.document.forms.Form1.elements.vpnne t' is null or not an
object

Is the syntax for identifying the server control input box incorrect?
Does
it have to do with the input box being nested in the "if statement". If I
use an html input box it works fine, the problem I need to attach code to
the
input box so server control.

Please help
cindy

Nov 19 '05 #2
the best way to start debugging this is to view source HTML and check
if the control exists with the name you are trying to refer ..

Also following may help..

it would be easier to use the 'returnValue' from modal window,when you
need to return only 1 value

open modal window like
var str = window.showModalDialog(" ....
if (str != "")
window.opener.document.forms["Form1"].elements["XYZ"].value = str
Assign window.returnValue = lstr from the popup

Nov 19 '05 #3
if the textbox is a child of another control (say a repeater), then its
rendered name and id will have the parents prepended with a seperator. you
can use the ClientId property to get the fully qualified id, but the name is
not supported.
-- bruce (sqlwork.com)
"cindy" <cm****@nospam.nospam> wrote in message
news:86**********************************@microsof t.com...
I have a web form "Form1" with a panel. Inside the panel is a datalist.
One
of the items displays the field value "xyz" from the dataset. If the
field
is null the user clicks on a javascript to let him pick a value for the
field
from a popup modal window.

<td><a href="javascript:GetNet()"> <img src=""> </a>VPN Network:</td>

<% if (XYZ !=""){%>
<td><asp:TextBox id="txtXYZ" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem, "XYZ") %>'></asp:TextBox>
<%}else{%>
<input type="text" runat=server id="XYZ">
<%}%></td>

The javascript on modal form tries to put a value selected back into
form1.XYZ with

function pasteNet(lstr)
{
window.opener.document.forms["Form1"].elements["XYZ"].value = lstr;
window.close();
}
I get the error

Microsoft JScript runtime error:
'window.opener.document.forms.Form1.elements.vpnne t' is null or not an
object

Is the syntax for identifying the server control input box incorrect?
Does
it have to do with the input box being nested in the "if statement". If I
use an html input box it works fine, the problem I need to attach code to
the
input box so server control.

Please help
cindy

Nov 19 '05 #4

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

Similar topics

2
by: Matt | last post by:
I reposted this question because I really want to accomplish this task. Please advise!! I want to post the form data (http://server/page1.asp) to a modal dialog window...
1
by: William Starr Moake | last post by:
The browser-based WYSIWYG editor I'm developing has a popup window with a form that generates table code from user input (width, border, cols, rows, bgcolor.) But the user has to copy-paste the...
1
by: stellabein | last post by:
Hi friends, I am very very new to programing. i have a one main window from that window i am opening one modal window using showmodaldialog(m.jp...). in that modal window i have a form. when i...
4
by: Brian Henry | last post by:
(please dont say don't do this because SP2 will block this, this is an internal site and i have full access to settings on the domain to make popup blocking turned off for this site) i have a...
8
by: tshad | last post by:
I am using Andy Smiths Dialog windows, which work really well. My only problem is I am trying to make the Dialogs Modal. Someone mentioned putting <base target="_self"> into the head section...
4
by: Hitesh | last post by:
Hi, I am opening an Modal dialog box using the window.Showmodaldialogbox(), and in that window i am having an aspx form with say one ASP.NET Button control. i am doing some operation on the...
2
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the...
0
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
1
by: Bali | last post by:
Default.aspx is the starting page containing a control(ascx) which has asp:button control on it. On the button click event it has to open a new page as a modal control. Since refreshing a page in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.