Question Answer Validation

Discussion in 'JavaScript' started by 1alpha, Aug 1, 2007.

  1. #1
    Hi,

    I have an autoresponder that is being spammed by bots accessing its signup forms. The provider is not giving me help on this one. I want to add a simple 'Answer a question' line to the signup form's existing validation javascript. The idea is to ask a question that needs intelligence to answer so that it will stump the spambots. Here is what I am trying to do:

    if (document.signup.fname.value == "") {
    alert("Please fill in your First name.")
    document.signup.fname.focus()
    return false}
    if (document.signup.question.value == "Mexico") {
    alert("Failed spam test question.")
    document.signup.question.focus()
    return false}

    The first if statement is from the original script, which I copied to produce the 2nd if statement which holds the validation question. I am not a programmer, so I don't know what to do to make the above work.

    Any help would be appreciated.

    Guy
     
    1alpha, Aug 1, 2007 IP
  2. disco_danny

    disco_danny Peon

    Messages:
    12
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    1alpha,
    If the text box value should be "Mexico" than you can use this-
    if (document.signup.question.value != "Mexico") {

    If you just want to check to see if the text box is blank you can use this-
    if (document.signup.question.value.length == 0) {

    Sorry, that is about as helpful as I can be based on the information I know.

    If this was not helpful, please provide the correct answer that you would like in the text box or let me know if you are using a select box and what the correct answer is.

    Disco
     
    disco_danny, Aug 1, 2007 IP