Alpha Video Training
Results 1 to 3 of 3

Thread: Javascript to get Dropdown value

  1. #1
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,609

    Default Javascript to get Dropdown value

    Can anyone help with a touch of javascript? I'm still figuring it out but can't get this one.

    I want to get the currently-selected value/text/choice of a dropdown list.

    Best I can find is this:

    Code:
    var w = document.dlg_Job.vLaminate_Status.selectedIndex;
    var vStatus = document.dlg_Job.vLaminate_Status.options[w].text;
    alert(vStatus);
    But the javascript error says that [document.dlg_Job.vLaminate_Status.selectedIndex; is null or not an object.

    I've figured out other ways to show the current value, but not what the user just selected.

    TIA!
    -Steve


  2. #2
    Member
    Real Name
    Martin Horzempa
    Join Date
    Oct 2005
    Posts
    224

    Default Re: Javascript to get Dropdown value

    Hi Steve


    maybe this will work

    var w = document.getElementById("vLaminate_Status");
    var vStatus = w.options[w.selectedIndex].text;
    alert(vStatus);

  3. #3
    Volunteer Moderator Steve Workings's Avatar
    Real Name
    Steve Workings
    Join Date
    Apr 2000
    Location
    The Dreaded Chair
    Posts
    5,609

    Default Re: Javascript to get Dropdown value

    Voila! I gotta ask these questions sooner -- before I spend so many hours on 'em. Thanks Martin.
    -Steve


Similar Threads

  1. Javascript
    By andymeer@yahoo.co.uk in forum Web Application Server v7
    Replies: 2
    Last Post: 02-03-2007, 04:30 PM
  2. javascript doSubmit()
    By Steve Wood in forum Web Application Server v7
    Replies: 8
    Last Post: 01-11-2006, 02:52 AM
  3. javascript
    By Josh Curtis in forum Web Application Server v6
    Replies: 3
    Last Post: 05-17-2005, 04:50 PM
  4. JavaScript
    By davidv43 in forum Web Application Server v6
    Replies: 2
    Last Post: 08-12-2004, 11:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •