473,545 Members | 319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

2 list-boxes with add & remove button

Hi all,

I would like to create a page with VBscript and ASP which will contain
two list-boxes one in the left side and the other in the right side
with two buttons namely "Add>>" and "<<Remove" so that if the user
selects a value listed in the left side list-box and presses "Add>>"
then that selected value should go inside the right side list-box.
Similarly if the user selects a value listed in the right side
list-box and after clicking "<<Remove" then that selected value should
go back to the left side list-box.

Can anyone provide me the code?

Some useful tutorial links explaining the above scenario can also be
given.

Any help is much appreciated and thanks in advance.

regards,
Ramamoorthy
Jul 22 '05 #1
2 3048
On 3 Feb 2005 22:31:51 -0800, ra******@gmail. com (Ramamoorthy
Ramasamy) wrote:
I would like to create a page with VBscript and ASP which will contain
two list-boxes one in the left side and the other in the right side
with two buttons namely "Add>>" and "<<Remove" so that if the user
selects a value listed in the left side list-box and presses "Add>>"
then that selected value should go inside the right side list-box.
Similarly if the user selects a value listed in the right side
list-box and after clicking "<<Remove" then that selected value should
go back to the left side list-box.

Can anyone provide me the code?


ASP wouldn't be the proper technology for this, you'd want to do this
on the client side. Check a VBScript or Javascript group, and keep in
mind that VBScript has limited support on non-Windows platforms.

Jeff
Jul 22 '05 #2
This is all the code you need...

<script language="JavaS cript">
<!-- hiding
function dosubmit() {}

function deleteOption(ob ject,index) {
object.options[index] = null;
}

function addOption(objec t,text,value) {
var defaultSelected = true;
var selected = true;
var optionName = new Option(text, value, defaultSelected , selected)
object.options[object.length] = optionName;
}

function copySelected(fr omObject,toObje ct) {
for (var i=0, l=fromObject.op tions.length;i< l;i++) {
if (fromObject.opt ions[i].selected)
addOption(toObj ect,fromObject. options[i].text,fromObjec t.options[i].valu
e);
}
for (var i=fromObject.op tions.length-1;i>-1;i--) {
if (fromObject.opt ions[i].selected)
deleteOption(fr omObject,i);
}
}

function copyAll(fromObj ect,toObject) {
for (var i=0, l=fromObject.op tions.length;i< l;i++) {
addOption(toObj ect,fromObject. options[i].text,fromObjec t.options[i].valu
e);
}
for (var i=fromObject.op tions.length-1;i>-1;i--) {
deleteOption(fr omObject,i);
}
}
function selectAll(fromO bject) {
for (var i=0, l=fromObject.op tions.length;i< l;i++) {
//addOption(toObj ect,fromObject. options[i].text,fromObjec t.options[i].va
lue);
fromObject.opti ons[i].selected = true;
}
}
// stop hiding -->
</script>


<table width = "100%" border = "0">
<tr>
<td>
<select size="15" name="ExtraArea s" class="inpt" multiple
style="width:18 0">
<%
'call stuff from databse her
%>
<option value="<!-- db value -->"><!-- db value --></option>
</select>
</td>

<td align = "center">
<input type="button" value="Add &raquo; "
onClick="copySe lected(this.for m.ExtraAreas,th is.form.ExtraAr eas1),
dosubmit(ExtraA reas1)" class = "button">
<input class = "button" type="button" value="&laquo; Remove"
onClick="copySe lected(this.for m.ExtraAreas1,t his.form.ExtraA reas),
dosubmit(ExtraA reas)">
</td>
<td class = "tableNorm" >
<select size="15" name="ExtraArea s1" class="inpt" MULTIPLE
style="width:18 0"></select>
</td>
</tr>
</table>

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2505
by: John Hunter | last post by:
I am writing a python extension module and have a reference counting question My function looks like static PyObject * pokereval_seven_cards(PyObject *self, PyObject *args) { int i;
7
2952
by: Klaus Neuner | last post by:
Hello, I need a function that converts a list into a set of regexes. Like so: string_list = print string_list2regexes(string_list) This should return something like:
9
3490
by: kazio | last post by:
Hello, So, I need to have double linked, circular list (last element point to the first one and first one points to the last one). I thought maybe I could use list container from STL, but unfortunately probably not. I checked it, and when I increase (++) iterator pointing to the last element the program crashes. I know the standard says,...
6
3075
by: massimo | last post by:
Hey, I wrote this program which should take the numbers entered and sort them out. It doesn¹t matter what order, if decreasing or increasing. I guess I'm confused in the sorting part. Anyone has any advices?? #include <iostream> using namespace std;
10
15105
by: Kent | last post by:
Hi! I want to store data (of enemys in a game) as a linked list, each node will look something like the following: struct node { double x,y; // x and y position coordinates struct enemy *enemydata; // Holds information about an enemy (in a game) // Its a double linked list node
3
2698
by: chellappa | last post by:
hi this simple sorting , but it not running...please correect error for sorting using pointer or linked list sorting , i did value sorting in linkedlist please correct error #include<stdio.h> #include<stdlib.h> int main(void) {
0
1812
by: drewy2k12 | last post by:
Heres the story, I have to create a doubly linked list for class, and i have no clue on how to do it, i can barely create a single linked list. It has to have both a head and a tail pointer, and each node in the list must contain two pointers, one pointing forward and one pointing backwards. Each node in the list will contain 3 data values:...
0
8613
by: Atos | last post by:
SINGLE-LINKED LIST Let's start with the simplest kind of linked list : the single-linked list which only has one link per node. That node except from the data it contains, which might be anything from a short integer value to a complex struct type, also has a pointer to the next node in the single-linked list. That pointer will be NULL...
0
2269
by: saijin | last post by:
I'm planning to call a list of data from an XML file but when I duplicate the content inside the <data></data> it is not showing anything Here's the ActionScript 3.0 import fl.controls.ComboBox; import fl.controls.TextArea; import fl.containers.UILoader;
7
5757
by: QiongZ | last post by:
Hi, I just recently started studying C++ and basically copied an example in the textbook into VS2008, but it doesn't compile. I tried to modify the code by eliminating all the templates then it compiled no problem. But I can't find the what the problem is with templates? Please help. The main is in test-linked-list.cpp. There are two template...
0
7457
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7802
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7410
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5962
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4941
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3443
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1869
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.