how do i check for options?

Results 1 to 2 of 2

Thread: how do i check for options?

  1. #1
    Join Date
    Dec 1969

    Default how do i check for options?

    I have state and country drop down box.<BR><BR>Based on selected country, states are populated.<BR>State is required if there are states, otherwise its not required.<BR>how do I can accomplish.the following script is not working<BR><BR>var frm = document.addupdatecandidate;<BR>var tstate = frm.cboStates.options.length;<BR><BR><BR>if (tstate == 0) {<BR>return true<BR>else<BR>alert("state required");<BR>return false;<BR> }

  2. #2
    Join Date
    Dec 1969

    Default Blocks are wrong.

    You need to block out the code for the if() separate from the else():<BR><BR>if (tstate == 0)<BR>{<BR> return true;<BR>}<BR>else<BR>{<BR> alert("State is required.");<BR> return false;<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