Visualizzazione dei risultati da 1 a 3 su 3
  1. #1

    [Problema validazione W3C] Tag input non posizionato bene

    Il validatore di W3C mi riporta 3 errori (tutti uguali) riferiti ad un form contenente tre elementi input.

    L'errore (che si ripete uguale per tutti e tre) è questo:

    Line 40, Column 86: document type does not allow element "input" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.

    …ype="hidden" name="utente" value="" /> <input type="hidden" name="password" va



    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 "

    " or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
    Il codice che genera l'errore è il seguente (risultato di php):

    codice:
    <!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">
    <head>
    	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    	<title>Sincope OnLine</title>
    	<script type="text/javascript">
    	//<!--
    	function sceglistile() {
    		document.getElementsByTagName("link")[0].disabled = true;
    		document.getElementsByTagName("link")[1].disabled = true;
    		larg = screen.availWidth;
    		if (larg < 1024) {
    			document.getElementsByTagName("link")[0].disabled = true;
    			document.getElementsByTagName("link")[1].disabled = false;
    		} else {
    			document.getElementsByTagName("link")[1].disabled = true;
    			document.getElementsByTagName("link")[0].disabled = false;
    		}
    	}
    	//-->
    	</script>
    	<link href="stili.css" rel="stylesheet" type="text/css" title="Risoluzione 1024 o superiore" />
    	<link href="stili800.css" rel="alternate stylesheet" type="text/css" title="800x600" />
    </head>
    <body onload="sceglistile();">
    	<div id="corpo">
    		<div id="testata"><h1>Sincope OnLine</h1></div>
    		<div id="nocciolo">
    			<div id="menu"><ul>
    				[*]Home
    				[*]Redazione
    				[*]Servizi
    				[*]Archivio
    				[*]Altro
    				[*]
    				[*]Forum
    			[/list]</div>
    			<div id="contenuto"><div class="riquadro"><h2>IpseDixit:</h2>
    
    
    ***</p>
    
    ***</p>
    
    ***</p>
    
    ***</p>
    <form action="arearis.php" method="post"><input type="hidden" name="utente" value="" /><input type="hidden" name="password" value="" /><input type="submit" value="Torna all'area riservata" /></form>			</div>
    
    			</div>
    		</div>
    		<div id="piede">
    
    Sito non a scopo di lucro progettato, costruito e mantenuto da Berello per il giornalino del liceo scientifico Plinio Seniore di Roma</p></div>
    	</div>
    </body></html>
    Dov'è che sbaglio?
    Mi sembra che il tag input sia contenuto in un tag form a sua volta contenuto in un div che è contenuto in un div... E tutti div fino al body! Non è lecito questo? Credevo di si.
    Non riesco a correggere l'errore. Qualche idea?

    Grazie

    P.S.:
    Ah, dimenticavo: la linea 40 è la sesta a partire dal basso, quella contenente il form e i tre input!
    "Meglio un aiuto che 50 consigli"
    (tratto dalle barrette Elah)

  2. #2
    inserisci gli input in un p:


    <input..
    oppure quando apri il form inserisci un field set:
    <fieldset><legend>Questo è un form</legend>
    <form><input /></form>
    </fieldset>

  3. #3
    Grazie!
    Il problema è risolto.
    Ho dovuto mettere il tag p intorno agli input, MA dentro form (fuori non funzionava!).

    Come posso capire dalla DTD che un elemento deve essere [direttamente o non direttamente] contenuto in un altro?

    Da questo pezzo non l'ho capito: (mi sembra che faccia rifrimento solo agli attributi di input)

    codice:
    <!ENTITY % InputType
      "(text | password | checkbox |
        radio | submit | reset |
        file | hidden | image | button)"
       >
    
    
    
    <!ELEMENT input EMPTY>     
    <!ATTLIST input
      %attrs;
      %focus;
      type        %InputType;    "text"
      name        CDATA          #IMPLIED
      value       CDATA          #IMPLIED
      checked     (checked)      #IMPLIED
      disabled    (disabled)     #IMPLIED
      readonly    (readonly)     #IMPLIED
      size        CDATA          #IMPLIED
      maxlength   %Number;       #IMPLIED
      src         %URI;          #IMPLIED
      alt         CDATA          #IMPLIED
      usemap      %URI;          #IMPLIED
      onselect    %Script;       #IMPLIED
      onchange    %Script;       #IMPLIED
      accept      %ContentTypes; #IMPLIED
      >
    Grazie per avermi risolto il problema!
    "Meglio un aiuto che 50 consigli"
    (tratto dalle barrette Elah)

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.