|
-
Oct 6th, 2002, 02:49 PM
#1
Thread Starter
Hyperactive Member
Submit onChange list
Hello,
I have a listbox with news items on a website. What I want it that when someone clicks on a news item (drop down, so the onChange event I think) the event should trigger a script (preferably VBScript ) and fill some text boxes with the data from the database.
I know how to get the data from the database, that works, what I want is that when someone clicks the list, the textboxes get filled...
How can I do this?
Msgbox(Document.lstNews.Text) does not work (Object doesn't support this property or method 'Document.News'
Thx
"Experience is something you don't get until just after you need it."
-
Oct 7th, 2002, 03:49 AM
#2
Hyperactive Member
try with onClick event of Listbox control
-
Oct 7th, 2002, 04:33 AM
#3
Thread Starter
Hyperactive Member
The onChange event does work, that is not the problem. The problem is the function code I call to handle the happenings. In this case, filling a text box with the information according to the selected list item.
"Experience is something you don't get until just after you need it."
-
Oct 7th, 2002, 04:37 AM
#4
Hyperactive Member
Re: Submit onChange list
Originally posted by BShadow
How can I do this?
Msgbox(Document.lstNews.Text) does not work (Object doesn't support this property or method 'Document.News'
Thx
hi,
Suppose the form name is form1 and text is lstNews ,then use the foll:
MsgBox(document.form1.lstnews.value)
by the way....if u use Vbscript it will worlk only on IE browsers...
regds,
ashay
"If you should die before me, ask if you could bring a friend."
- Stone Temple Pilots
-
Oct 7th, 2002, 02:44 PM
#5
Addicted Member
So you want to display data on the page based on a dropdown selected? Three ideas:
Use an XMLHttp object to call another webpage that will run the query you want and return data in the HTTP response. This can be in HTML, plain text, or XML. You can get that data back and write it to your page. I have a javascript example:
Code:
objRequest = new ActiveXObject("Microsoft.XMLHTTP");
// use POST if you are posting form information, use
// GET to put the information in the URL
objRequest.open("POST","URL",false);
objRequest.send(data if using POST, blank of using GET);
if (objRequest.status == 200)
{
// for XML
objXML = objRequest.responseXML;
// for html or text
document.write objRequest.responseText;
}
This probably only works for IE.
Or, hide all of the information you would display for each item in the dropdown in spans. Give each span an id equal to the value in the dropdown. DIsplay and hide as necessary:
Or, Final idea: refresh the current asp page, include the value of the dropdown in the querystring, and display the data that way
Wydok
"It would appear that we have reached the limits of what it is possible to achieve with computer technology, although one should be careful with such statements, as they tend to sound pretty silly in 5 years."
-John Von Neumann ca. 1949
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|