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

writing values in form of other window

Hi all,

i can't figure this one out. from a main window i am opening another
window with a form in it. this form has an inputbox. from the main
window i want to write a value into this inputbox. so i need the handle
from the child window and write the value into this form.

i tried using:

var chWindow=window.open('form_with_input.htm');
var chForm=chWindow.document.forms[0];

chForm.name_of_element.value='test'; //didn't work.
chForm.id_of_element.value='test'; //didn't work.

both didn't work... can somebody help?
is it even possible what i am trying to do?

cheers, Danny
Jul 23 '05 #1
2 1367
chWindow and chForm should be objects not variables. Try the following
example.

<script language=javascript>
function test() {
childW = window.open('form_wit*h_input.htm', 'childW',
'toolbar=no,directories=no,menubar=no,scrollbars=y es, location=no,
resizable=yes, WIDTH=600,HEIGHT=350');

if (childW != null) {
childW.document.open();
childW.document.bgColor = "ccffcc";
childW.document.write('<html><body><form name=form1><input
type=text name=ID value=000></form></body></html>');
chForm = childW.document.forms[0];
alert(chForm.ID.value);
chForm.ID.value="123456789";
alert(chForm.ID.value);

} else {
alert("Failed to open child window");
}
}
</script>

<a href='javascript:test()'>Test It!</a>
SCDeveloper
http://www.sharingcorner.com

Jul 23 '05 #2
SCDeveloper wrote:
chWindow and chForm should be objects not variables. Try the following
example.

<script language=javascript>
function test() {
childW = window.open('form_wit*h_input.htm', 'childW',
'toolbar=no,directories=no,menubar=no,scrollbars=y es, location=no,
resizable=yes, WIDTH=600,HEIGHT=350');

if (childW != null) {
childW.document.open();
childW.document.bgColor = "ccffcc";
childW.document.write('<html><body><form name=form1><input
type=text name=ID value=000></form></body></html>');
chForm = childW.document.forms[0];
alert(chForm.ID.value);
chForm.ID.value="123456789";
alert(chForm.ID.value);

} else {
alert("Failed to open child window");
}
}
</script>

<a href='javascript:test()'>Test It!</a>
SCDeveloper
http://www.sharingcorner.com


I understand the functionallity, much applied. Thanx!

Now would this technique be possible if you have an excisting website
(which is not yours) with a form in it, to write values in the
inputboxes as a prefill. or does the http/html-security prohibit this.

so for instance there is a website 'http://www.blabla.com' with a form
and several inputboxes. from my website i want to open this site in
which i've let have filled some values into these inputboxes. i tried to
but the javascript debugger console in mozilla tels me that the instance
form (chForm) has not properties.

this indicates that this is a security issue, am i right? i just thought
it would be another handle to a window-object.

Danny
Jul 23 '05 #3

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

Similar topics

1
by: Keith | last post by:
This is for an Intranet application before I go any further. I have a form which requires calendar dates, cities etc. to be input. This is not a problem, but when a user clicks to input a date...
3
by: User | last post by:
Form A (Main) Text Box 1 Text Box 2 Text Box 3 Form B (Pop-up) Choose a selection for Form A/Text Box 3 Scenario:
2
by: jackson2005 | last post by:
OK, I need to do three different things. On the ONLOAD event I would like a popup box to open. In this popup box I need two text boxes. One for the UserName and one for the BillingTo name. ...
3
by: harikrishnan.kamalakannan | last post by:
Hi, When a open an asp page from a modal window through window.open, my session values of parent(the screen that invoked the modal window) are lost. Please this is urgent.
0
by: chris | last post by:
On my testing server where I installed .NET Runtime files, I have some problems with showing to the user the correct data from database. I have a grid displaying all companies. When user edits a...
1
by: ramapv | last post by:
Are the values in a form submitted to a file which is opened in a new window at onsubmit attribute of that form. <FORM method=GET onsubmit=window.open("exper.jsp","win","width=50,height=50") > ...
1
by: colleen1980 | last post by:
Hi: Can any one please tell me that how to i pass the two textbox values in the new page. If i use the form action in the popup window page then the new page is open in the same popup window as i...
6
by: vncntj | last post by:
I have this home.js file and I'm trying to collect the values on the other at "emplist.aspx" function poponload() { testwindow= window.open ("emplist.aspx", "mywindow",...
5
by: kosta.triantafillou | last post by:
Hi all, I have a form that contains a lot of values. On this form there are also alot of popups that can be brought up. One of them does the following: Takes 2 values (x and y), concatenates...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.