Results 1 to 5 of 5

Thread: Submit onChange list

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425

    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."

  2. #2
    Hyperactive Member buddu's Avatar
    Join Date
    Jul 2001
    Location
    India
    Posts
    446
    try with onClick event of Listbox control
    prasad

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    The Netherlands
    Posts
    425
    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."

  4. #4
    Hyperactive Member ashay's Avatar
    Join Date
    Feb 2002
    Location
    Mumbai,India
    Posts
    278

    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

  5. #5
    Addicted Member
    Join Date
    Aug 2000
    Location
    Pennsylvania, USA
    Posts
    168
    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
  •  



Click Here to Expand Forum to Full Width