472,104 Members | 1,080 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,104 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 1331
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

17 posts views Thread by amber | last post: by
1 post views Thread by active | last post: by
5 posts views Thread by Tom | last post: by
6 posts views Thread by =?Utf-8?B?TWFyY2Vsbw==?= | last post: by

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.