[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

How to transfer input from a form to a new page

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
blind
Asked:
blind
  • 6
  • 3
1 Solution
 
blindAuthor Commented:
Thanks in advance to everyone who knows or at least tried.
0
 
martinagCommented:
Could you post the code, please? I think we'll be able to solve your problems.

Martin
0
 
blindAuthor Commented:
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 Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
rafisternCommented:
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
 
blindAuthor Commented:
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
 
blindAuthor Commented:
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
 
rafisternCommented:
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
 
blindAuthor Commented:
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
 
rafisternCommented:
Try xyz.focus(); after you're finished writing to it.
0
 
blindAuthor Commented:
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

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.

  • 6
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now