Results 1 to 6 of 6

Thread: How to send value of textbox input to popup window ?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    How to send value of textbox input to popup window ?

    Hi all i got a textbox and i allow the user enter some value and hit the submit. On submit i want that value be passed to javascript and that javascript opens a popup window along with that value. I have done most of the part only don't know how to pass value of text box to javascript on click of submit. I be happy if some one help with it.


    Note : i don' want the form get redirected to new page !!


    HTML Code:
    <form method="POST" action="--WEBBOT-SELF--">
      
      <input type="text" name="T1" size="20"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>

    Code:
    <script language="javascript">
    
    
    function newWindow(url) { 
    	var x,y;
    	x = screen.width-35;
    	y = screen.height-30;
    	var win = window.open(url,'glossaryWindow','toolbar=no,directories=no,width=500,height=500'+
    	'screenX=0,screenY=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');
    }  
    
    // Start of Playme Function
    function playme()
    {
    tempUrl ='';
    url = '';
    
    
    	//alert(tempUrl);
    	url = "./player.php?songid=" + tempUrl.replace(/,$/,"");
    
    	newWindow(url);
    	return false;
    }		
    // End of Playme Function	
    // -->	
    </script>

  2. #2
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: How to send value of textbox input to popup window ?

    In main page:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
      <HEAD>
    	<META HTTP-EQIV="Content-Type" CONTENT="text/html; charset=utf-8">
        <TITLE> New Document </TITLE>
    	<SCRIPT LANGUAGE="JavaScript">
    	<!--
    		function newWindow(url) { 
    	var x,y;
    	x = screen.width-35;
    	y = screen.height-30;
    	var win = window.open(url,'glossaryWindow','toolbar=no,directories=no,width=500,height=500'+
    	'screenX=0,screenY=0,top=0,left=0,location=no,status=no,scrollbars=no,resize=yes,menubar=no');
    } 
    	//-->
    	</SCRIPT>
      </HEAD>
      <BODY>
        <INPUT TYPE="text" NAME="txtData" ID="txtData">
    	<INPUT TYPE="button" value="Click Me" onclick="Javascript: newWindow('popup.html');" >
      </BODY>
    </HTML>
    In popup.html
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
      <HEAD>
    	<META HTTP-EQIV="Content-Type" CONTENT="text/html; charset=utf-8">
        <TITLE> New Document </TITLE>
      </HEAD>
      <BODY>
         <INPUT TYPE="text" NAME="txtData2" ID="txtData2">
    	 <SCRIPT LANGUAGE="JavaScript">
    	 <!--
    		txtData2.value = window.opener.document.getElementById('txtData').value;
    	 //-->
    	 </SCRIPT>
      </BODY>
    </HTML>
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to send value of textbox input to popup window ?

    Thanks for your help. But how to use that typed value inside popup window inside this code in the body part :




    <param name="movie" value="mp3player.swf?file=test.php?Id=...
    I want the input value to be placed at the end of Id= in the popup window!!
    I know how to do it via post and get if the values were checkbox but in this case user types integers!!
    Furthermore, is there away to use div window or dhtml window instead of popup window ?
    I hope i be able to get help achiving this .thanks

  4. #4
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: How to send value of textbox input to popup window ?

    Well, looks like you are coding PHP. I don't know PHP, but in JSP I'll add the id after ? and use request.gatParameter() in popup.jsp. PHP must has something like that.

    In plain HTML see if this works:
    Inside <head>
    Code:
    	<SCRIPT LANGUAGE="JavaScript">
    	<!--
    		function getParameter()
    		{
    			return "mp3player.swf?file=test.php?Id=" + window.opener.document.getElementById('txtData').value;
    		}
    	//-->
    	</SCRIPT>
    In body:
    Code:
    <param name="movie" value="javascript: getParameter();" >
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  5. #5
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,729

    Re: How to send value of textbox input to popup window ?

    or a simple document.write may work;
    In <body>
    Code:
    <SCRIPT LANGUAGE="JavaScript">
    	document.write("<param name='movie' value='" + "mp3player.swf?file=test.php?Id=" + window.opener.document.getElementById('txtData').value + "' >");
    </SCRIPT>
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  6. #6
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How to send value of textbox input to popup window ?

    If it's a popup window, use window.opener.document.getElementById('someHiddenField').value and set the value to what the user entered in the textbox in the popup window. Then you can do what's in #5 by concatenating the values.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width