Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 1st, 2004, 11:27 AM
Authorized User
 
Join Date: Nov 2004
Location: , , .
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Default Listbox/textbox

I want a listbox with a list but also let the user write into like in a textbox.


Thank you thank you Thank you (...)

Johnjohn

Reply With Quote
  #2 (permalink)  
Old December 1st, 2004, 06:05 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

mmmmm, I dont believe thats possible with any kind of select/combo box, you do mean a select/combo box I asume? Any how here is something I believe will work for you, it does that and a bit more (lets you add to and re order the list)

BTW : This would have been better suited in the javaScript forum

-----------------cut n paste code--------------------------------
<html>
<HEAD>
<title>Multiple Select Re-Order and Add</title>
<SCRIPT LANGUAGE="JavaScript">
function move(fbox,tbox) {
var i = 0;
if(fbox.value != "") {
var no = new Option();
no.value = fbox.value;
no.text = fbox.value;
tbox.options[tbox.options.length] = no;
fbox.value = "";
   }
}
function remove(box) {
for(var i=0; i<box.options.length; i++) {
if(box.options[i].selected && box.options[i] != "") {
box.options[i].value = "";
box.options[i].text = "";
   }
}
BumpUp(box);
}
function BumpUp(abox) {
for(var i = 0; i < abox.options.length; i++) {
if(abox.options[i].value == "") {
for(var j = i; j < abox.options.length - 1; j++) {
abox.options[j].value = abox.options[j + 1].value;
abox.options[j].text = abox.options[j + 1].text;
}
var ln = i;
break;
   }
}
if(ln < abox.options.length) {
abox.options.length -= 1;
BumpUp(abox);
   }
}
function Moveup(dbox) {
for(var i = 0; i < dbox.options.length; i++) {
if (dbox.options[i].selected && dbox.options[i] != "" && dbox.options[i] != dbox.options[0]) {
var tmpval = dbox.options[i].value;
var tmpval2 = dbox.options[i].text;
dbox.options[i].value = dbox.options[i - 1].value;
dbox.options[i].text = dbox.options[i - 1].text
dbox.options[i-1].value = tmpval;
dbox.options[i-1].text = tmpval2;
      }
   }
}
function Movedown(ebox) {
for(var i = 0; i < ebox.options.length; i++) {
if (ebox.options[i].selected && ebox.options[i] != "" && ebox.options[i+1] != ebox.options[ebox.options.length]) {
var tmpval = ebox.options[i].value;
var tmpval2 = ebox.options[i].text;
ebox.options[i].value = ebox.options[i+1].value;
ebox.options[i].text = ebox.options[i+1].text
ebox.options[i+1].value = tmpval;
ebox.options[i+1].text = tmpval2;
      }
   }
}
</script>
</HEAD>
<BODY>
<form ACTION="" METHOD="POST">
<table>
 <tr>
  <td><input type="text" name="list1" value=""></td>
  <td><input type="button" value="Add" onclick="move(this.form.list1,this.form.list2)" name="B1"><br>
      <input type="button" value="Delete" onclick="remove(this.form.list2)" name="B2"><br><br>
      <input type="button" value="Up" onclick="Moveup(this.form.list2)" name="B3"><br>
      <input type="button" value="Down" onclick="Movedown(this.form.list2)" name="B4"></td>
  <td><select multiple size=7 name="list2">
       <option value="one">Kite</option>
       <option value="two">Surfing</option>
       <option value="three">is</option>
       <option value="four">Taking</option>
       <option value="five">Over</option>
       <option value="six">The</option>
       <option value="six">World</option>
      </select></td>
 </tr>
</table>
</form>
</body>
</html>
---------------------end cut n paste code------------------

Wind is your friend
Matt
Reply With Quote
  #3 (permalink)  
Old December 8th, 2004, 09:49 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, Matt

can you send the code that a dropdown list (combobox) but also let the user write into like in a textbox ?

regards.

Mateen


Reply With Quote
  #4 (permalink)  
Old December 8th, 2004, 06:07 PM
Friend of Wrox
Points: 6,664, Level: 34
Points: 6,664, Level: 34 Points: 6,664, Level: 34 Points: 6,664, Level: 34
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2004
Location: Sydney, NSW, Australia.
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

mateenmohd

If you have another read of my post you will notice a question, answering it will assist you in a solution.

The cut n paste code I have posted, did you run it?
What does that code fail to do relative to your objective?
The code posted used a multi select box. You asked for a list box, this could mean a select box or a multi select box. What type are you after?
Select box = user can make only one selection
Multiple Select box = user may make multiple selections

Wind is your friend
Matt
Reply With Quote
  #5 (permalink)  
Old December 11th, 2004, 12:14 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for response.

yes I run you code, it is good.

Select box (dropdwon) = user can make only one selection

only single selection select box need.


regards.

Mateen


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I set TextBox value from asp.net Listbox, vishnu108mishra ASP.NET 2.0 Professional 1 March 10th, 2008 06:11 AM
multiple Listbox values in another listbox terryv Excel VBA 0 June 27th, 2007 07:01 AM
listbox/Textbox/sql Rudner VB How-To 0 March 9th, 2005 02:44 AM
Listbox to textbox Freddyfred Access VBA 2 May 10th, 2004 10:37 PM
I'm back :) Listbox var from listbox MichaelTJ .NET Web Services 2 October 21st, 2003 07:06 PM



All times are GMT -4. The time now is 06:35 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.