how can you

Results 1 to 5 of 5

Thread: how can you

  1. #1
    Join Date
    Dec 1969

    Default how can you

    How can I know if the top value in the drop down box is selected using asp ...something like document.formname.selectboxname.vlaue = 0<BR>in js<BR>any help

  2. #2
    ugh Guest

    Default RE: nice title


  3. #3
    Join Date
    Dec 1969

    Default RE: how can you

    You can&#039;t just do it in any on page way like with JS. You would just have to have the user submit the form, then grab the variable, check to see what they selected against the top variable in the box, then act accordingly.

  4. #4
    Join Date
    Dec 1969
    Los Angeles, CA

    Default Assuming you meant client side

    document.formname.objectname.options[document.formname.objectname.selectedIndex].value will give you the value selected<BR><BR><BR>now what you can do is while populating the dropdown save the FIRST value into a variable then <BR><BR>if (document.formname.objectname.options[document.formname.objectname.selectedIndex].value == &#060;%=VariableName%&#062;)<BR>{<BR>//code when you select the first item in the dropdown<BR>}

  5. #5
    Join Date
    Dec 1969

    Default Well, yes...but that's the hard way...

    Why couldn&#039;t you just do<BR><BR>if (document.formName.listName.selectedIndex == 0) <BR>{<BR>&nbsp; &nbsp; // top value was selected<BR>}<BR><BR>selectedIndex *always* starts at zero and increments by 1, so that is guaranteed to be safe.<BR><BR>However, I really do think the guy was asking for a server side answer.<BR><BR>

Posting Permissions

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