Ir para conteúdo
Fórum Script Brasil
  • 0

Validar w3c


Guest --lorenzi --

Pergunta

Guest --lorenzi --

PEssoal seguinte tinha meu codigo funcionando legal validando beleza mas dai inseri a opção value e parou de funcionar a validadação:

<td><input class="fendereco" type="text" name="endereco" id="endereco" value="<?=$escrever["endereco"];?>" /> </td>

sabem me dizer como eu faço pra validadr isso??

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

Depende, o que o php retorna? Qual erro que o validador especifica?

Posta a mensagem de erro do validador, aí da pra saber o que foi que aconteceu.

Posta o código todo também, porque dependendo do seu doctype algo pode não ser permitido.

Abraço.

Link para o comentário
Compartilhar em outros sites

  • 0

este é alguns dos erros:

# Line 77, Column 96: an attribute value literal can occur in an attribute specification list only after a VI delimiter.

…tato" value="<?=$escrever["id_contato"];?>" />

Have you forgotten the "equal" sign marking the separation between the attribute and its declared value? Typical syntax is attribute=value".

# Error Line 77, Column 96: document type does not allow element "input" here; missing one of "th", "td" start-tag.

…tato" value="<?=$escrever["id_contato];?>" />

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

# Error Line 77, Column 97: end tag for "input" omitted, but OMITTAG NO was specified.

…ato" value="<?=$escrever["id_contato"];?>" />

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".

Meu codigo:

<?xml version="1.0" encoding="iso-8859-2"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pt-br" lang="pt-br">
 <?php
      $id = $_GET["id"];
      if ($id != "")
      {
         include "conf.php";
         $res = mysql_query("select * from contato where id_contato = '$id'");
         $escrever=mysql_fetch_array($res);
      }
      else
      {
         /*zerar os campos*/
      }

 ?>
<head>
  <script type="text/javascript">
     function Verifica() {
       var nome    = document.getElementById("nome").value;
        var telefone = document.getElementById("telefone").value;
        if (nome == "" ||
            telefone == ""){
            alert('Campo nome e telefone são obrigatórios');
            document.getElementById("nome").focus();
            return false;
        }else
        return true;
      }
      function maskIt(w,e,m,r,a){
         // Cancela se o evento for Backspace
         if (!e) var e = window.event
            if (e.keyCode) code = e.keyCode;
            else if (e.which) code = e.which;

            // Variáveis da função
             var txt  = (!r) ? w.value.replace(/[^\d]+/gi,'') : w.value.replace(/[^\d]+/gi,'').reverse();
             var mask = (!r) ? m : m.reverse();
             var pre  = (a ) ? a.pre : "";
             var pos  = (a ) ? a.pos : "";
             var ret  = "";

         if(code == 9 || code == 8 || txt.length == mask.replace(/[^#]+/g,'').length) return false;
           // Loop na máscara para aplicar os caracteres
            for(var x=0,y=0, z=mask.length;x < z && y<txt.length;){
               if(mask.charAt(x)!='#'){
                 ret += mask.charAt(x); x++;
               }else{
                 ret += txt.charAt(y); y++; x++;
               }
            }
           // Retorno da função
            ret = (!r) ? ret : ret.reverse()
            w.value = pre+ret+pos;
         }
         // Novo método para o objeto 'String'
            String.prototype.reverse = function(){
            return this.split('').reverse().join('');
      };
  </script>
  <title>Tela para manipulação de registros</title>
  <meta name="Keywords" content="telefone,lista" />
  <meta name="Author" content="LORENZI" />
  <link rel="stylesheet" type="text/css" href="novo.css" />
</head>
<body>
  <form method="post" action="contato.php" onsubmit="return Verifica()">
   <div class="dLista">
     <div class="dLista1">
        <h3> Inclusão,Exclusão,Alteração da lista </h3>
     </div>
     <div class="dLista2">
     <table class="ftable1">
        <tr>
          <input name="id_contato" type="hidden" id="id_contato" value="<?=$escrever["id_contato"];?>" />
          <td>Nome:</td>
          <td><input class="fnome" type="text" name="nome" id="nome" value="<?=$escrever["nome"];?>" /></td>
        </tr>
        <tr>
          <td>E-mail:</td>
          <td><input class="femail" type="text" name="email" id="email" value="<?=$escrever["email"];?>" /></td>
        </tr>
        <tr>
          <td>Endereço:</td>
          <td><input class="fendereco" type="text" name="endereco" id="endereco" value="<?=$escrever["endereco"];?>"  /> </td>
      </tr>
      <tr>
        <td>Cidade:</td>
        <td><input class="fcidade" type="text" name="cidade" id="cidade" value="<?=$escrever["cidade"];?>"/> </td>
        <td>Estado</td>
        <td>
           <select name="Estado" id="estado" value="<?=$escrever["estado"];?>">
             <option>SC</option>
             <option>AC</option>
             <option>AL</option>
             <option>AM</option>
             <option>AP</option>
             <option>BA</option>
             <option>CE</option>
             <option>DF</option>
             <option>ES</option>
             <option>GO</option>
             <option>MA</option>
             <option>MG</option>
             <option>MS</option>
             <option>muito</option>
             <option>PA</option>
             <option>PB</option>
             <option>PE</option>
             <option>PI</option>
             <option>PR</option>
             <option>RS</option>
             <option>RJ</option>
             <option>RN</option>
             <option>RO</option>
             <option>RR</option>
             <option>SE</option>
             <option>SP</option>
             <option>TO</option>
           </select></td>
       </tr>
       <tr>
         <td>CEP:</td>
         <td><input class="fcep" type="text" name="cep" id="cep" value="<?=$escrever["cep"];?>"  maxlength="9" onkeyup="maskIt(this,event,'#####-###')" /> </td>
       </tr>
       <tr>
         <td>Telefone:</td>
         <td><input class="ftelefone" type="text" name="telefone" id="telefone" maxlength="13" value="<?=$escrever["telefone"];?>" onkeyup="maskIt(this,event,'(##)####-####')" /> </td>
       </tr>
       <tr>
         <td>Celular:</td>
         <td><input class="ftelefone" type="text" name="celular" id="celular" maxlength="13" value="<?=$escrever["celular"];?>" onkeyup="maskIt(this,event,'(##)####-####')" /> </td>
       </tr>
       <tr>
          <td>Skype:</td>
          <td><input class="femail" type="text" name="skype" id="skype" value="<?=$escrever["skype"];?>"  /> </td>
       </tr>
    </table>
    </div>
    <div class="dLista3">
        <input class="button" type="submit" value="Incluir" name="incluir" />
        <input class="button" type="submit" value="Alterar" name="alterar" />
        <input class="button" type="submit" value="Excluir" name="excluir"/>
        <input class="button" type="button" value="Retornar Consulta" onclick="window.location='consultanatabela.php'" />
    </div>
   </div>
 </form>
</body>
</html>

Grato

Link para o comentário
Compartilhar em outros sites

  • 0

Você tem o html validator no seu firefox instalado?

Ele ajuda e muito. Praticamente faz o serviço todo.

Tem muitos problemas no seu código, tire todos os valores php dos campos pra validar o html, já que o validador valida html e não php. Ele se confunde com as aspas que usa para dar o echo em php. Coloque valores de teste, apenas para validar seu html.

Tem uma linha onde o input tá dentro da tag tr. Dentro da tag tr só pode tbody, thead, th, td...

Se você alterar os valores do php para valores normais, já vai pular de 20 erros pra uns 2 ou 3, ou até acabar com os erros.

Abraço.

Link para o comentário
Compartilhar em outros sites

  • 0

É correto, mas o validador não entende php.

Não tem nada de errado, porém na hora da validação convém trocar os valores para saber se o html está correto.

Você poderia fazer duas coisas, acessar sua página e pegar o html resultante dos includes do php e validar, ou colocar os valores só com html como eu comentei antes.

Faça o seguinte, se sua página está hospedada, acesse-a e copie e cole o código dela num notepad, salve como html e valide.

Abraço.

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...