Popup window to Fill Selection Box in parent window

This is related to my previous question about the 2 dynamic Selection Boxes:

I have 2 selection boxes: 1 with a list of employees and 1 with a list of selected employees. Using arrows you can move an empoyee from the Available List to the Selected List. This works great and makes it very clear for our clients. Now I would like to add the following functionality:

The Available Selection box lists employees depending on a certain query depending on the chosen Department. What I would like to add is a button called 'Add Custom Employee' that brings up a popup window where I can select an employee from any department and add it to the list of Selected Employees. Problem is how can I do that. The popup window will be easy to make and will bring up a list of employees depending on your search query. Now once the employee has been found that the user wants to add to the Selected Employee list he should be able to press a 'Add this Employee' button that will close the popup and post back two variables to the parent window: EMP_ID and EMP_NAME. These variables should then be placed in the parent window in the form of an added option in the Selected Employees box.

I hope the question is clear but I can imagine it is not so to summarize:

How can I post back 2 variables from a popup window to its parent window and place them as an option in a selection box on the parent window.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ZvonkoSystems architectCommented:
What about this:

function PopUpProfile(theSel){
  nw = window.open("select.htm", "profile", "top=100,left=100,height=400,width=300");
<SELECT NAME="SelectedEmployee" MULTIPLE onDblClick="PopUpProfile(this)">

And here the popup page "select.htm":

function putSel(EMP_ID, EMP_NAME){
  opt = opener.document.forms[0].SelectedEmployee.options;
  opt.length ++;
  opt[opt.length-1].value = EMP_ID;
  opt[opt.length-1].text = EMP_NAME;
<a href="javascript:putSel('EMP_IDa', 'EMP_NAMEa')">EMP_NAMEa</a><br>
<a href="javascript:putSel('EMP_IDb', 'EMP_NAMEb')">EMP_NAMEb</a><br>
<a href="javascript:putSel('EMP_IDc', 'EMP_NAMEc')">EMP_NAMEc</a><br>

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ZvonkoSystems architectCommented:
Does upper option pass back work for you?
It worked in my tests.

pgkooijmanAuthor Commented:
Just finished implemented it, it works! Thanks and again points given :)
ZvonkoSystems architectCommented:
Thank you too.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.