473,396 Members | 1,872 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Needs help as i am trying to pull all recrods from the listbox

Hi: I am trying to pull all the values from the listbox. But the ASP
code shows only the last record. Needs help

HTML

<html>
<head>

<body>
<h2><center>DECEASED DATA SEARCH</center></h2>
<br><br>
<table border='0' align='center'>
<form name='deceasedsocial' id='deceasedsocial' method='POST'
onsubmit="return selectAllOptions()">

<tr>
<td>Enter Social Security Number</td><td><input type='text' name='ssn'
id='ssn'>&nbsp&nbsp<select id="lstSSN" name="lstSSN"></select></td></
tr>
<tr><td><input type="button" value="Add" onclick="return
loadList();"></select>
<input type="button" value="Delete" onclick="return deleteIt();"></
select>
<input type="submit" value="Process"
onClick="this.form.action='ProcessDeceased.asp'";>

</td></tr>
<tr><td><input type="submit" value="Todays Deceased"
onClick="this.form.action='hello.asp'";>
</td></tr>

</table>
</form>
<script language="JavaScript">
var frm = document["deceasedsocial"];
function loadList() {
intCount = frm.lstSSN.length;
frm.lstSSN.options[intCount] = new
Option(frm.ssn.value,frm.ssn.value);

// Get textbox, clear it then focus onto it.
var textbox = document.getElementById('ssn');
textbox.text = "";
textbox.focus();
document.getElementById('ssn').value=""
document.getElementById('ssn').focus();
return true;
}

function deleteIt()
{
for (var i=(frm.lstSSN.options.length-1); i>=0; i--)
{
var o=frm.lstSSN.options[i];
if (o.selected) {
frm.lstSSN.options[i] = null;
document.getElementById('ssn').focus();
return true;
}
}
return true;
}

function selectAllOptions() {
var ref = document.getElementById('lstSSN');
for(i=0; i<ref.options.length; i++)
ref.options[i].selected = true;
return true;
}

</script>
</body>


ASP

lstSSN = request.form( "lstSSN")
response.write(lstSSN)

Mar 24 '07 #1
1 1418
On Mar 24, 12:55 pm, "colleen1...@gmail.com" <colleen1...@gmail.com>
wrote:
Hi: I am trying to pull all the values from the listbox. But the ASP
code shows only the last record. Needs help
I don't understand the point, surely you already know all the values
in the select. But anyhow, below is some help, you'll likely need
more.
>
HTML

<html>
<head>

<body>
It's always a good idea to start with valid HTML - the W3C validator
is free and quite good:

<URL: http://validator.w3.org/ >
<h2><center>DECEASED DATA SEARCH</center></h2>
<br><br>
<table border='0' align='center'>
<form name='deceasedsocial' id='deceasedsocial' method='POST'
onsubmit="return selectAllOptions()">
More invalid HTML. A form can't be a child of a table, put the table
inside the form:

<form ...>
<table ...>
>
<tr>
<td>Enter Social Security Number</td><td><input type='text' name='ssn'
id='ssn'>&nbsp&nbsp<select id="lstSSN" name="lstSSN"></select>
An empty select is invalid, it must have at least one option. If you
want to select and submit more than one option, make it a multiple
select.

<URL: http://www.w3.org/TR/html401/interac...ml#edef-SELECT >

</td></
tr>
<tr><td><input type="button" value="Add" onclick="return
loadList();"></select>
There is no opening tag for that select closing tag. Input elements
don't have a closing tag.

[...]
</table>
</form>
<script language="JavaScript">
The language attribute is deprecated, remove it. Type is required.
var frm = document["deceasedsocial"];
function loadList() {
intCount = frm.lstSSN.length;
Where is frm defined?

frm.lstSSN.options[intCount] = new
Option(frm.ssn.value,frm.ssn.value);

// Get textbox, clear it then focus onto it.
var textbox = document.getElementById('ssn');
textbox.text = "";
Input elements don't have a text attribute.

textbox.focus();
document.getElementById('ssn').value=""
document.getElementById('ssn').focus();
You can reuse the text box reference, call its focus method once at
the end:

var textbox = document.getElementById('ssn');
textBox.value = '';
textbox.focus();
return true;

}

function deleteIt()
{
for (var i=(frm.lstSSN.options.length-1); i>=0; i--)
Where is frm defined?
{
var o=frm.lstSSN.options[i];
if (o.selected) {
frm.lstSSN.options[i] = null;
document.getElementById('ssn').focus();
return true;
}
}
return true;

}

function selectAllOptions() {
var ref = document.getElementById('lstSSN');
Change ref to a multiple select here, its appearance may change so you
might need to control that.
--
Rob

Mar 24 '07 #2

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

Similar topics

17
by: amber | last post by:
Hello. Can someone tell me what I may be doing wrong here? I'm using the code (lboxRP is a listbox): Dim newRPindex As Integer newRPindex = Me.lboxRP.FindString(RP)...
0
by: Moe Sizlak | last post by:
Hi There, I am trying to get the value from a listbox, I have a class in my code behind page and I have created a sub to try to capture the selected value of the listbox but it keeps giving me...
1
by: active | last post by:
Code below. Starting to use DragDrop and I get the message that the index is out of range when I mouse down and move a little. The box has maybe 10 items and I'm selecting one in the middle. ...
2
by: baret bonden | last post by:
Trying to return a selected listbox item to another form .tried lots of ways; defining public variables and passing those as well as textboxes ..I' m able to display the chosen item on it's form...
2
by: DartmanX | last post by:
I have a form that does the following: - User inputs a serial number - VBA code does a lookup (SQL Query) and populates a listbox with results (4 columns in the Listbox) - Start Over (Listbox...
5
by: Tom | last post by:
Hi, I'm new to asp.net 2.0 and I'm working on creating a web site that allows user to log into the web site and view information pertaining to them such as accounts, sales, and other information...
6
by: =?Utf-8?B?TWFyY2Vsbw==?= | last post by:
Hello, I am new to pulling data into VB and using DataGridViews..... so this might be a dumb question but I can not seem to understand how to make this work. What I need acomplished: Exec a...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
12
by: denveromlp | last post by:
Hello, I'm new to Access and trying to calculate a rolling 12 month average from some time data. Each data point is a date and a measurement taken at that date. As far as I can tell, the only...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.