Results 1 to 4 of 4

Thread: dropdown select action?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Hi,
    I'm using VBScript and I was wondering if someone had an example or even advise on grabbing the selected text of a dropdown(not a problem) and updating the page everytime a new selection is chosen(this is my problem). Can anyone help?

  2. #2
    Frenzied Member monte96's Avatar
    Join Date
    Sep 2000
    Location
    Somewhere in AZ
    Posts
    1,379
    Depends on what you need to update. If the data is relatively small, you can store it within the page in arrays that have page scope. These arrays can be used to populate other fields and select/option groups based on the selections of another.

    Basically you have to create client side code using server side code.
    oOOo--oOOo
    __/\/\onte96
    oOOo--oOOo
    Senior Programmer/Analyst
    MCP
    [email protected]
    [email protected]


    Your results may vary.. some restrictions may apply.. pricing and participation may vary.. not available in all states.. professional driver closed course..quantities limited..

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    Ok that's helpful but I'm dealing with alot of info in a database. What I really need to know is what action is triggered when I select an option, how can I take the option's value and put it into a Sql statement, and have it executed by the page by recalling itself?

  4. #4
    Fanatic Member ZeBula8's Avatar
    Join Date
    Oct 2002
    Posts
    548

    Re: dropdown select action?

    you can use the 'OnChange' event for the select object:

    <form name="order" method="post">

    <select name="products" onchange="doSomething()">

    where 'doSomething' is a function that performs your action(s).

    <script language="javascript">
    function doSomething()
    {
    var si = document.order.products.selectedIndex;
    var partNo = document.order.products.options[si].value;
    var desc = document.order.products.options[si].text;
    alert("you selected part number " + partNo + ", '" + desc + " ' ");
    }

    </script>

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