[thelist] Javascript question

Eric Vitiello evolt at perceive.net
Tue Jan 22 14:36:29 CST 2002


-- josh [Tue, 22 Jan 2002 15:07:18 GMT]:

><head>
><script language=Javascript>
>
>function validate()
>
>    if (document.all.board_decision_comments.value == '' &&
>document.all.board_decision.value == 'Denied' ) {
>    alert ("Please enter reason for denial.")
>    return false
>    }
>}
></script>



try:


function validate()

    if (document.all.board_decision_comments.value == '' && document.all.board_decision.selectedIndex == 2 ) {
    alert ("Please enter reason for denial.")
    return false
    }
}


 - the select element does not have a "value"  you must check to see what the selectedIndex is.  this holds a value for the item in the options array that is selected.  the select Element has an options array which holds each option child element.


---
Eric Vitiello
Perceive Designs
<www.perceive.net>






More information about the thelist mailing list