• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 6335
  • Last Modified:

Double Click in Selection Box to bring up popup

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:

I would like to create it in a way that people can double-click on the name of the employee in the Selected Employee box and that double-clicking on that name will bring up a popup with that employee's profile. I am guess something like this but just do not know how to write it in JScript:

<JAVASCRIPT>
PopUpProfile()
{
window.open("profile.asp?EMP_ID=" + document.formname.SelectedEmployee,SelectedItem.value);
}
</JAVASCRIPT>

<SELECT NAME="SelectedEmployee" OnDoubleClick="javascript:PopUpProfile()">
<OPTION VALUE="EMP_ID">Employee Name</OPTION>
</SELECT>

Is this possible and if so, how?
0
pgkooijman
Asked:
pgkooijman
  • 3
  • 2
1 Solution
 
ZvonkoSystems architectCommented:
Like this:

<html>
<head>
<SCRIPT>
function PopUpProfile(theSel){
  window.open("profile.asp?EMP_ID=" + theSel.value, "profile", "top=100,left=100,height=400,width=300");
}
</SCRIPT>
</head>
<body>
<form>
<SELECT NAME="SelectedEmployee" MULTIPLE onDblClick="PopUpProfile(this)">
<OPTION VALUE="EMP_ID1">Employee Name1</OPTION>
<OPTION VALUE="EMP_ID2">Employee Name2</OPTION>
<OPTION VALUE="EMP_ID3">Employee Name3</OPTION>
</SELECT>
</form>
</body>
</html>


0
 
pgkooijmanAuthor Commented:
Hi ZVonko, I am afraid everything works but it is not getting any value for EMP_ID. theSel.value is undefined. Any way to fix that problem?
0
 
ragerinoCommented:
try this:
window.open("profile.asp?EMP_ID=" + theSel.options[thieSel.selectedIndex].value, "profile", "top=100,left=100,height=400,width=300");

normally when using the multiple attribute in select-elements you have to use a loop to check which options are selected. but you are using a doubleclick so when you first click a option it becomes selected the second time the ondblclick-event is fired.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
ZvonkoSystems architectCommented:
Moin' Alex :-)

@pgkooijman: are you talking about my upper example or about yout version?
Any code can have typos, also mine ;-)

0
 
pgkooijmanAuthor Commented:
Whoopsie, my error. It works, thanks, points given!
0
 
ZvonkoSystems architectCommented:
No problem.
Thanks for points.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

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