Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    May 2013
    Thanked 0 Times in 0 Posts

    Fighting jQuery form validation again

    Can Someone tell me what is wrong with this validation with jQuery?

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      <title>Negócios Angola</title>
      <base href="http://root.com/divdev/">
      <meta http-equiv="Content-Type" content="text/html; charset=Western (ISO-8895-1)" />
      <link rel="stylesheet" type="text/css" href="css/backend.css">
      <script src="//code.jquery.com/jquery-1.9.1.js"></script>
      <script src="//ajax.aspnetcdn.com/ajax/jquery.validate/1.9/jquery.validate.min.js"></script>
      // When the browser is ready...
      $(function() {
        // Setup form validation on the #addcat element
            // Specify the validation rules
            rules: {
                categories: "required",
                newcat: "required",
                catdesc: "required"
            // Specify the validation error messages
            messages: {
                categories: "Tem que seleccionar a categoria parente",
                newcat: "Introduza nova categoria",
                catdesc: "Descreva a categoria"
            submitHandler: function(form) {
          <div class="searchspace">
          <div class = "search">
            <form class = "searchform">
            	<input class = "searchfield" type = "text" value = "Procurar..." onfocus = "if (this.value == 'Procurar...') {this.value = '';}" onblur="if (this.value == '') {this.value = 'Procurar...';}" />
            	<input class = "searchbutton" type = "button" value = "GO" />
          <div class="infospace">
    INFO LINE      </div>
          <div class="leftspace">
    <div class = "menu">
      <ul class="sexypanels">
      <li><a href="admin/addcat.php">» Adicionar Categorias</a></li>
      <li><a href="http://www.dynamicdrive.com/style/" >» CSS Examples</a></li>
      <li><a href="http://www.javascriptkit.com/jsref/">» JavaScript Reference</a></li>
      <li><a href="http://www.javascriptkit.com/domref/">» DOM Reference</a></li>
      <li><a href="http://www.cssdrive.com">» CSS Drive</a></li>
      <li class="lastitem"><a href="http://www.codingforums.com/">» Coding Forums</a></li>
    </div>      </div>
          <div class="middlespace">
                                                                                       <div class = "addcatheader">
        Adicionar novas Categorias  </div>
      <div class = "addcat">
        <form id = "addcat" method="post">
          <table width = "100%" border = "0">
              <td width = "40%" align = "right" valign = "top"><label for="categories">Categoria Parente:</label></td>
              <td width = "60%">
                <select id = "categories" name = "cat_parent">
                  <option value = 0>Topo</option><option value = 2>&nbsp;&nbsp;|___Tecnologias da Informação</option><option value = 3>&nbsp;&nbsp;|&nbsp;&nbsp;|___Informática</option><option value = 5>&nbsp;&nbsp;|&nbsp;&nbsp;|&nbsp;&nbsp;|___Venda de Computadores </option><option value = 6>&nbsp;&nbsp;|&nbsp;&nbsp;|&nbsp;&nbsp;|___Consumiveis</option><option value = 4>&nbsp;&nbsp;|&nbsp;&nbsp;|___Infrastructuras</option>            </select>
              <td colspan = "2">&nbsp;</td>
              <td align = "right" valign = "top"><label for="newcat">Nome da Categoria:</label></td>
              <td><input id = "newcat" type ="text" name = "cat_name"></td>
              <td colspan = "2">&nbsp;</td>
              <td align = "right" valign = "top"><label for="catdesc">Descrição da Categoria:</label></td>
              <td><textarea id = "catdesc" name = "cat_desc"></textarea></td> 
              <td colspan = "2">&nbsp;</td>
              <td colspan = "2" align = "center"><button id = "submit" type = "submit">Adicionar</button></td>
          <div class="footer">
            <div class = "footerdiv">
              Negócios Angola - &copy; 2012 <br />
              <a href=href="mailto:admin@negiciosangola.com" style = "text-decoration: none; color: #ffffff";>Contactar o Webmaster</a>
    It is not validating the form. Can some one help me please??

    Thank You

  2. #2
    Administrator VIPStephan's Avatar
    Join Date
    Jan 2006
    Halle (Saale), Germany
    Thanked 1,314 Times in 1,284 Posts
    Any messages in the error console?
    I notice that your forms lack the action attributes, so they can’t be submitted anyway which is why the submitHandler is kinda useless.

  3. #3
    New Coder
    Join Date
    May 2013
    Thanked 0 Times in 0 Posts
    It is the same script, so no need to have action information. And I assure you it is submitting the data.

    I get no errors messages or what soever


Posting Permissions

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