472,805 Members | 920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 software developers and data experts.

How to load drop down list vaules from the main page to popup window?

Hi,
Functionality is like when pressing 'CTRL+click' on drop down list in the main jsp page, a popup window appears with a list box contains all the values of the drop down clicked on the main page. But some times when we expand the drop down and press "CTRL+click" on any of the options in the main jsp, values are not getting populated in the popup window List box. Is any other options to load values from main jsp to popup jsp fle?

Pls see the code used in the popup window to list the values:

Expand|Select|Wrap|Line Numbers
  1. <script>
  2.     function populateList() {     
  3.      var size = eval("window.opener.document.forms[0]."+elementName+".length");
  4.      for(var i = 0;i<Number(size);i++){
  5.      var txt = eval("window.opener.document.forms[0]."+elementName+".options["+i+"].innerText");
  6.      var val = eval("window.opener.document.forms[0]."+elementName+".options["+i+"].value");
  7.      var newOption = new Option(txt, val, false, false);
  8.      document.forms[0].listBox.options[i] = newOption;
  9.      }
  10.     }
  11.  
  12.     </script>
  13.   <body onload = "javascript:populateList();">
Feb 13 '07 #1
1 6679
acoder
16,027 Expert Mod 8TB
Don't use eval.
Try this instead:
Expand|Select|Wrap|Line Numbers
  1. <script>
  2.     function populateList() {
  3.      var size = window.opener.document.forms[0][elementName].length;
  4.      for(var i = 0;i<size;i++) {
  5.      var txt = window.opener.document.forms[0][elementName].options[i].text;
  6.      var val = window.opener.document.forms[0][elementName].options[i].value;
  7.      var newOption = new Option(txt, val, false, false);
  8.      document.forms[0].listBox.options[i] = newOption;
  9.      }
  10.     }
  11. </script>
  12. <body onload = "javascript:populateList();">
I'm assuming you've set the elementName somewhere. If not, that should be the problem.
Feb 13 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: vikram.cvk | last post by:
Hello Experts, Im trying to design a CSS vertical drop down menu which should have the following functionality. Home About Us | -->Overview
1
by: Tom Ewall | last post by:
I have an iframe which has a drop-down list, which I'm trying to use to refresh a drop-down list in the main page. I'm using this call to refresh the page: ...
9
by: John Kirksey | last post by:
I have a page that uses an in-place editable DataGrid that supports sorting and paging. EnableViewState is turned ON. At the top of the page are several search fields that allow the user to filter...
7
by: Jeremy | last post by:
I would like to implement a Drop-Down list that can show a thumbnail graphic next to the text in each row. Is this possible with anything that ships with VS.NET 2003? Or do I have to use a 3rd...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
15
by: H00ner | last post by:
Hello All Hope you can help Been pulling my hair out about a popup problem in ASP.NET. One of the forms i wrote requires the user to select a product from a list in a popup web form. the...
4
by: teknoshock | last post by:
I have created a page with multiple drop down boxes, all populated with the same options. My problem is, for 12 dropdown boxes and 40 choices per box, I end up with a massive file. Also, if I...
6
by: Rob Meade | last post by:
Hi all, Looking for a bit of help if possible. For about 2 weeks now I've been investigating the best way to populate related drop down menus, and have their values pre-populated again if the...
0
by: mjohnson0321 | last post by:
I am trying to incorporate a CSS drop-down menu into a site (suckerfish menu). The menu gets lost behind the content below it, but only on one of the drop downs (News). The error occurs on all of...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.