Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to transfer input from a form to a new page

Posted on 1999-01-01
10
Medium Priority
?
183 Views
Last Modified: 2010-08-05
I'm having trouble with transferring some input from a textbox to a whole new javascript-called window. I mean, the window doesn't link to another page, it just takes the information they typed in the textbox and send it to the new
window by itself.

here is the name of the boxes (there are three of them):
inputbox1
inputbox2
inputbox3

they are all on the same form and I just want the info from the "inputbox3" to go to the new window.

the form they are in is called:
testform

the information from the first two inputboxes is compiled and sent to the "inputbox3".
so that is why the other two inputboxes are important.

I wanted a button that would run the javascript that compiles the "inputbox1" and "inputbox2" information, and then, instead of sending it to "inputbox3", it would send the input to a whole new window. But I do not want to change the original javascript. I wanted a javascript that would run the original javascript and then send the info to the new window.

0
Comment
Question by:blind
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 3
10 Comments
 

Author Comment

by:blind
ID: 1276260
Thanks in advance to everyone who knows or at least tried.
0
 
LVL 4

Expert Comment

by:martinag
ID: 1276261
Could you post the code, please? I think we'll be able to solve your problems.

Martin
0
 

Author Comment

by:blind
ID: 1276262
I have changed the code a bit since then so now there are only two boxes.

Here's the code:


<html>

<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
<title>whatever</title>
</head>

<body>

<form name="testform">
    <p align="center"><font color="#000000"><strong>Inputbox1</strong></font><br>
    <textarea name="inputbox1" rows="6" cols="55"></textarea><font
    color="#0000FF"><strong><br>
    Inputbox2:<br>
    </strong></font><font color="#0080FF"><input type="password"
    size="23" name="inputbox2"> <br>
    <br>
    </font></p>
    <p align="center"><font color="#0080FF"><input type="button"
    name="button" value="Encrypt \ Decrypt"
    onclick="encrypt_decrypt()"> <input type="reset" name="B1"
    value="Reset All"> </font></p>
    <p align="center"><input type="submit" name="B2"
    value="this is the button I was hoping could render a new window with Input box1's entered input"></p>
</form>
<script>
<!--
function encrypt_decrypt() {
        var Ret = encode (testform.inputbox1.value, testform.inputbox2.value)
        testform.inputbox1.value = Ret;
}
function encode (OrigString, CipherVal) {    
Ref="%#$*0123456789abcde fghijklmno@pqrstuvwxyzÀÁÂÃÄÅÆÇ~ÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÿþýüûúùø÷öõôóòñðïîíìëêéèçæåäãâáà¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿|.!?,/\[]{}:;<>()+-=_ABCDEFGHIJKLMNOPQRSTUVWXYZ"
        CipherVal = parseInt(CipherVal)
        var Temp=""
        for (Count=0; Count < OrigString.length; Count++) {
                var TempChar = OrigString.substring (Count, Count+1)
                var Conv = cton(TempChar)
                var Cipher=Conv^CipherVal
                Cipher=ntoc(Cipher)
                Temp += Cipher
        }
        return (Temp)
}

function cton (Char) {
        return (Ref.indexOf(Char));
}
function ntoc (Val) {
        return (Ref.substring(Val, Val+1))
}
// -->
</script>
</body>
</html>

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 4

Expert Comment

by:rafistern
ID: 1276263
When you call the new page in the window do it like this:

newWin=open("newpage.html","x","options....");if(!newWin.opener)newWin.opener=window;

The last bit is necessary for NS2 & IE3 browsers.

Then in the new page put onload="fillField()" in the body tag where

function fillField(){
  document.forms[0].input3.value = opener.window.document.forms[0].input1.value+opener.window.document.forms[0].input2.value;
}

is defined in the header of the page.

The syntax opener.window.document gives full compatibility to NS2/IE3. If you know that your page will never be accessed by these browsers then omit the if(!newWin.opener) bit and the .window. from the function leaving opener.document.etc..
0
 

Author Comment

by:blind
ID: 1276264
Sorry, rafistern

I'm not a very good explainer seeing as I am new to javascript and all.

I meant one of those WINDOWS that are created by a javascript.

I also changed the source code a little, so there is no "inputbox3".  

If YOU do manage to answer this question, I will give you 144 points instead of 100 (that's all I have).

Thank You
0
 

Author Comment

by:blind
ID: 1276265
Sorry, rafistern

I'm not a very good explainer seeing as I am new to javascript and all.

I meant one of those WINDOWS that are created by a javascript.

I also changed the source code a little, so there is no "inputbox3".  

If YOU do manage to answer this question, I will give you 144 points instead of 100 (that's all I have).

Thank You

0
 
LVL 4

Accepted Solution

by:
rafistern earned 560 total points
ID: 1276266
OK,

xyz=open("","x","options....");
xyz.document.open();
xyz.document.write("<html><head></head><body>");
xyz.document.write(document.forms[0].input1.value + document.forms[0].input2.value);
xyz.document.write("</body></html>");
xyz.document.close();

Get the idea?
0
 

Author Comment

by:blind
ID: 1276267
That did it, Rafistern!
You da man!
Thanks, and here's that 144 points I promised you.

I have one problem though...
when it creates it it dissapears into the background and I have to click on it at the Windows 98 toolbar to bring it back up.

I you can help me with this, I would apreciate it very much.

0
 
LVL 4

Expert Comment

by:rafistern
ID: 1276268
Try xyz.focus(); after you're finished writing to it.
0
 

Author Comment

by:blind
ID: 1276269
Some time inbetween my comment and yours I was fooling around with it and got it fixed without xyz.focus(); could it have been the xyz return; I added?

No need to answer this, it works and that's all I care about.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question