Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Please help me out...deadline is evening

    Hi,
    Please help me to do validation for the drop down in using java script.
    The drop down field is in the table of every row. And the rows are creating dynamically.

    The requirement is the drop down field is mandatory.

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    SELECT tags can be validated in two ways - by selectedIndex, or by the value of the selectedIndex. (Notice the capital "I".. it must be capitalized, or it won't work.)

    If your form name is "formName" and the select is named "selectName":
    if(document.forms["formName"].selectName.selectedIndex == 0) means "if the select is in the first position" (it's a zero-based index.)

    if(document.forms["formName"].options[document.forms["formName"].selectedIndex].value == "") means "if the value of the current selection is blank".
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".


  •  

    Posting Permissions

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