473,804 Members | 3,063 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 3058
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
2525
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
2972
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
3509
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, this is a linear list (with beginning and the end), but I completely don't understand why they...
6
3109
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
15137
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
2714
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
1825
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: an item ID (string), a quantity (integer) and a price (float). The ID will contain only letters and...
0
8639
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 if the end of the single-linked list is encountered. The single-linked list travels only one...
0
2289
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
5776
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 classes. One is List1, the other one is ListNode. The codes are below: // test-linked-list.cpp :...
0
10594
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10331
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9166
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7631
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5529
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.