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 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Validations needed

    Hello Programmers,
    Please help me write the validations for the given code
    (Category Name & description should not be empty).

    Thanks

    <html>
    <title>form</title>
    <head>
    <body>
    Category Name <input type="text" name="myform" method="post"><br>
    Category Description <textarea rows="10" cols="30"> </textarea>
    <input type="submit" value="Submit">
    <input type="button" value="Cancel">
    </body>
    </html>

  • #2
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by shahwali View Post
    Hello Programmers,
    Please help me write the validations for the given code
    (Category Name & description should not be empty).

    Thanks

    <html>
    <title>form</title>
    <head>
    <body>
    Category Name <input type="text" name="myform" method="post"><br>
    Category Description <textarea rows="10" cols="30"> </textarea>
    <input type="submit" value="Submit">
    <input type="button" value="Cancel">
    </body>
    </html>
    somebody help me please

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    You should try searching the forums for an answer, it is a common question.
    If you have trouble putting it together ask for more help.

  • #4
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've been searching it since the time I posted the question.
    But couldnt find the code
    and by the way, thanks for showing interest, I really appreciate it.

  • #5
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    Here's an example:
    Code:
    <html>
    <title>form</title>
    <script type="text/javascript">
    function validateForm(frm){
    if (frm.txt.value.search(/\w/) == -1) {
      alert('Category Name Must Have A Value');
      frm.txt.focus();
      return false;
      }
    else if (frm.txtarea.value.search(/\w/) == -1) {
      alert('Category Description Must Have A Value');
      frm.txtarea.focus();
      return false;
      }
    else { return true; }
    }
    </script>
    <head>
    <body>
    
    <form name="myform" id="myform" method="post" action="" enctype="multipart/form-data" onsubmit="return validateForm(this)">
    Category Name <input type="text" name="txt" id="txt" value=""><br>
    Category Description <textarea name="txtarea" id="txtarea" rows="10" cols="30"></textarea>
    <input type="submit" value="Submit">
    <input type="reset" value="Cancel">
    </form>
    
    </body>
    </html>

  • #6
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank You so very much


  •  

    Posting Permissions

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