469,288 Members | 2,357 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,288 developers. It's quick & easy.

Populate textbox in new window

Hi guys,
Lots of threads and ideas, but I couldn't find what I'm looking for.
Hence, this.

I have asp page (say, 1.asp) that has a textbox. This page is available
to me in read-only mode, meaning I know all the field names, functions
names etc., but can't change anything.

Now, I need to write .htm or .asp (2.htm or 2.asp) that will have a
textbox and submit button. When user clicks on submit two things have
to happen:
1) 1.asp opens in new browser window
2) textbox in 1.asp gets populated with textbox value from 2.htm (or
2.asp)

It may sound like piece of cake, but it's turned into a problem for me.
Any help would be appreciated.

Aug 12 '05 #1
1 2674
ASM
got4a wrote:
Now, I need to write .htm or .asp (2.htm or 2.asp) that will have a
textbox and submit button. When user clicks on submit two things have
to happen:
1) 1.asp opens in new browser window
2) textbox in 1.asp gets populated with textbox value from 2.htm (or
2.asp)

It may sound like piece of cake, but it's turned into a problem for me.
Any help would be appreciated.


as I understood the two forms (1.asp and 2.htm)
are exactly same (except button to send infos to 1.asp)

function pop() {
if(!(!truc) || !truc.closed) truc.close();
truc=window.open('1.asp','','width=300,height=250' );
txfer();
}
function txfer() { // copy content of each textbox from 2 to 1
var a = document.forms[0].elements;
var b = truc.document.forms[0].elements;
for(var i=0;i<b.length;i++) if(a[i].type=='text') b[i].value=a[i].value;
}

in file '2.htm' :

<input type=button onclick="pop();"
value="Open Pop-Up and Transfer Datas">
</form>

or with your case (only 1 textbox + 1 submit button)

file '2.htm' :

<html>
<script type="text/javascript">
function pop() {
var a = document.forms[0].elements[0];
if(a.value.length<1) {
alert('Fill the field of text')
a.focus(); a.select();
}
else {
if(!(!truc) || !truc.closed) truc.close();
truc=window.open('1.asp','','width=300,height=250' );
var b = truc.document.forms[0].elements[0];
b.value = a.value;
alert('that\'s done');
}
}
</script>
<form onsubmit="pop();return false;">
Name : <input type="text">
<input type="submit" value="OK">
</form>
</html>
--
Stephane Moriaux et son [moins] vieux Mac
Aug 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by C. David Rossen | last post: by
1 post views Thread by Celine | last post: by
2 posts views Thread by Junior | last post: by
11 posts views Thread by eureka | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.