Solved

How to transfer input from a form to a new page

Posted on 1999-01-01
10
148 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
  • 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
 
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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 140 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

When you need to keep track of a simple list of numbers or strings, the Array object is your most direct tool.  As we saw in my earlier EE Article (http://www.experts-exchange.com/A_3488.html), typical array handling might look like this: (CODE) B…
The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now