DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2007
    Posts
    30

    Help me with this code for popup..plss..

    Hi..I have to popup childwindow...and the value selected there shd get displayed in parent window textbox. But when i select the value and click submit button in child nothing is happening.. Below is my code: pls help.
    Parent:
    Code:
    <SCRIPT language="JavaScript">
    		var newwindow;
    		function poptastic(url)
    		{
    			newwindow=window.open(url,'name','height=200,width=400,left=250,top=90,scrollbars=1');
    			if (window.focus) {newwindow.focus()}
    		}
    </SCRIPT>
    Code:
    <body>
    <form id="Form1" method="post" encType="multipart/form-data" runat="server">
    			<table cellSpacing="5" cellPadding="4" width="826" bgColor="#2d3d6e" border="0">
    				<TBODY>
    					<tr>
    						<td width="193"><font face="Arial Black" color="#ffffff" size="2">REQUESTER ID : &nbsp;</font></td>
    						<td width="428"><font face="Verdana" color="#000080" size="2"><asp:textbox id="popuptext" Width="50px" Rows="1" Runat="server"></asp:textbox>&nbsp;
    								<a href="javascript:poptastic('ItUser_PopUp.aspx'); ">Pop it</a><font face="Verdana" color="#000080" size="2"></font></font></td>
    					</tr>
    				</TBODY>
    			</table>
    </form>
    </body>
    ChildWindow:
    Code:
    <SCRIPT language=JavaScript>
    		
    		function storeToParent()
    			{
    				//alert("Test");
    				var rbgroup_value;
    				for (i=0;i<document.Form2.rbgroup.length;i++)
    				{
    					if (document.Form2.rbgroup[i].checked)
    					{
    						rbgroup_value = document.Form2.rbgroup[i].value;
    						window.opener.Form1.popuptext.value = rbgroup_value;
    						window.close()
    					}
    				}
    			}
    		
    		</SCRIPT>
    Code:
    <body MS_POSITIONING="GridLayout">
    <form id=Form2 method=post runat="server">
    <table width="100%" border=1>
      <tr>
        <td>
        <td><asp:label id=lblCurrentPage runat="server"></asp:label></TD></TR></TABLE><asp:repeater id=popup Runat="server">
    							<HeaderTemplate>
    					<table border="1" width="826">
    						<tr>
    							<th width="1%" height="16" align="center" bgcolor="#2D3D6E""><b><font size="2" face=Verdana color="#FFFFFF">
    								SELECT</th>
    							<th width="4%" height="16" align="center" bgcolor="#2D3D6E""><b><font size="2" face=Verdana color="#FFFFFF">
    								USERID</th>
    							<th width="14%" height="16" align="center" bgcolor="#2D3D6E""><b><font size="2" face=Verdana color="#FFFFFF">
    								USERNAME</th>							
    						</tr>
    				</HeaderTemplate>
    				<ItemTemplate>
    					<tr>
    						<td width="1%" height="16" align="center" bgcolor="#FAF0E6"><b><font size="2" face=Verdana color="#000000">
    							<asp:RadioButton ID=rbgroup runat="server" Width="32px" Height="24px"></asp:RadioButton></td>
    						<td width="4%" height="16" align="center" bgcolor="#FAF0E6"><b><font size="2" face=Verdana color="#000000"><%#Container.DataItem("USER_ID")%></td>
    						<td width="14%" height="16" align="center" bgcolor="#FAF0E6"><b><font size="2" face=Verdana color="#000000"><%#Container.DataItem("USER_NAME")%></td>
    					</tr>
    				</ItemTemplate>
    
    				
    						</asp:Repeater></TD></TR></TABLE>
    							<TABLE width="100%">
    							<tr align=center>
    								<td><input type=button ID=submit value='Select' onclick="storeToParent()"></input></TD></TR></TABLE></FORM>
    								</body>

  2. #2
    Join Date
    Aug 2007
    Posts
    9
    Try to use the parent object on child page and a function that will be executed on parent page, like:

    //Parent

    function fillin(s){
    document.forms[0].a1.focus();
    document.forms[0].a1.value = s;
    return true;
    }
    // where a1 is a field in a form
    //Child
    <form>
    <select NAME="choice">
    <option VALUE="one">One</option>
    <option VALUE="two">Two</option>
    <option VALUE="three">Three</option>
    </select>
    <input TYPE="Button" VALUE="OK" onClick="parent.fillin(this.form.choice.options[this.form.choice.selectedIndex].value);">
    </form>

Similar Threads

  1. Jupitermedia Legal Notice -- NO PERMISSION TO USE CODE SAMPLES?!
    By Noryk Rekrap in forum Talk to the Editors
    Replies: 3
    Last Post: 08-23-2007, 03:56 PM
  2. wot is CLR
    By lostguy in forum .NET
    Replies: 8
    Last Post: 04-03-2002, 06:41 PM
  3. .NET equals Efficiency
    By Kevin in forum .NET
    Replies: 150
    Last Post: 03-04-2002, 05:40 PM
  4. Another Language
    By Steven Bell in forum .NET
    Replies: 260
    Last Post: 06-01-2001, 04:32 PM
  5. error code in JSP(please chek the code)
    By satish in forum Java
    Replies: 1
    Last Post: 09-22-2000, 09:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links