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 10 of 10
  1. #1
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts

    What should I add or remove?

    I was wondering if anyone could tell me anything I should add or remove, or anything on my contact forms

    http://www.owt200x.us/contactform

    There is 2 versions of the contact form, one uses OpenCaptcha while the other uses MathCaptcha.

    I know the website looks bleh, I need feedback on the contact forms themselves.

    Thanks,
    Barry

  • #2
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    Were I in your position, I'd add some form of JavaScript validation (plus the server-side you already have, of course.)

  • #3
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    the only javascript i can do is copy/paste. why add javascript validation? why have 2 when theres already one. could you explain why?

  • #4
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    The javascript happens on the client machine. No network/internet traffic involved. That makes it faster and cheaper.
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • #5
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    i dont know javascript, so i have no idea how to add it

  • #6
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by owt200x View Post
    the only javascript i can do is copy/paste. why add javascript validation? why have 2 when theres already one. could you explain why?
    two reason pro:
    - can help user with form validation before pushing submit to check with php
    - afaik bots don't interpret javascript, you can use this to avoid spam

    best regards

  • #7
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    cant bots disable JS? anyway, i dont know how to code JS, im trying to find a JS form validation to look at now.
    Last edited by owt200x; 12-12-2008 at 09:37 PM.

  • #8
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    I use a JS submit once script in the form. which uses the OnSubmit tag inside the <form> area, can you use 2 OnSubmit tags? once for submit once, and one for JS form validation?

  • #9
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts
    Code:
    function validateEmpty(fld) {
        var error = "";
     
        if (fld.value.length == 0) {
            fld.style.background = 'Yellow'; 
            error = "The required field has not been filled in.\n"
        } else {
            fld.style.background = 'White';
        }
        return error;  
    }
    This is called by:
    Code:
    function validateFormOnSubmit(theForm) {
    var reason = "";
    
      reason += validateUsername(theForm.username);
      reason += validatePassword(theForm.pwd);
      reason += validateEmail(theForm.email);
      reason += validatePhone(theForm.phone);
      reason += validateEmpty(theForm.from);
          
      if (reason != "") {
        alert("Some fields need correction:\n" + reason);
        return false;
      }
    
      return true;
    }
    This is called by:
    Code:
    <form name="demo" onsubmit="return validateFormOnSubmit(this)" action="test.htm">
    <table summary="Demonstration form">
      <tbody>
      <tr>
        <td><label for="username">Your user name:</label></td>
        <td><input name="username" size="35" maxlength="50" type="text"></td>
      </tr>   
      <tr>
        <td><label for="pwd">Your password</label></td>
        <td><input name="pwd" size="35" maxlength="25" type="password"></td>
      </tr>   
      <tr>
        <td><label for="email">Your email:</label></td>
        <td><input name="email" size="35" maxlength="30" type="text"></td>
      </tr>  
      <tr>
        <td><label for="phone">Your telephone number:</label></td>
        <td><input name="phone" size="35" maxlength="25" type="text"></td>
      </tr>   
      <tr>
        <td>
            <label for="from">Where are you :</label></td>
        <td><input name="from" size="35" maxlength="50" type="text"></td>
      </tr>   
      <tr>
        <td>&nbsp;</td>
        <td><input name="Submit" value="Send" type="submit" ></td>
        <td>&nbsp;</td>
      </tr>
      </tbody>
    </table>
    </form>
    This is from this page (http://webcheatsheet.com/javascript/...n.php#required)

    Disclaimer: I don't advocate using tables to format the form. I only put one of the tests as an example.
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • Users who have thanked jerry62704 for this post:

    owt200x (12-12-2008)

  • #10
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    thanks, I will add javascript validation for the contact form in my next update.


  •  

    Posting Permissions

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