473,382 Members | 1,436 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,382 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 5381
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
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: 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
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
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...

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.