Pagina 1 di 2 1 2 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 12
  1. #1

    W3C e attributo Placeholder

    Buongiorno.

    In un form ho questo:
    codice HTML:
    <label for="nome">Nome <span>*</span></label><a name="nome"></a>
    <input tabindex="1" type="text" name="nome" id="nome" value="" placeholder="Inserisci il tuo nome" required/>
    Quando tento la validazione W3C, mi dà questo errore:

    Line 74, Column 82: there is no attribute "placeholder"…" name="nome" id="nome" value="" placeholder="Inserisci il tuo nome" required/>
    You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.


    In pratica non gli piace il "placeholder", ma quello che non capisco è "cosa devo fare?".
    Il W3C mi dice che il Placeholder non deve sostituire la Label, ma io la Label ce l'ho.
    Forse devo fare qualcosa con il CSS invece che con l'HTML?

    Grazie.

  2. #2
    No dai... rinuncio al W3C.
    Peccato, se non fosse per il form, avrei la pagina validata.
    Però questa non riesco proprio a comprenderla:

    codice HTML:
    <textarea tabindex="5" cols="50" rows="10" name="messaggio" id="messaggio" placeholder="Inserisci un testo" required/></textarea>

    Line 82, Column 135
    : end tag for element "textarea" which is not open…essaggio" id="messaggio" placeholder="Inserisci un testo" required/></textarea>
    The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.If this error occurred in a script section of your document, you should probably read this FAQ entry.

  3. #3
    Utente di HTML.it L'avatar di cassano
    Registrato dal
    Aug 2004
    Messaggi
    3,002
    LEVA QUESTO :

    required/>
    In

    required>

  4. #4
    but the document type you are using does not support that attribute


    mi sembra chiaro, il documento che stai usando non supporta l'attributo placeholder.. dovresti usare la Doctype Html5 per usarlo.
    Questa volta, più che un voto.. è favoreggiamento.

  5. #5
    Quote Originariamente inviata da cassano Visualizza il messaggio
    LEVA QUESTO :

    required/>
    In

    required>
    required al W3c non piace, ma se faccio la correzione che mi suggerisci, oltre che del required, si lamenta anche di questo:

    end tag for "input" omitted, but OMITTAG NO was specified

  6. #6
    ma non lo devi togliere da "input"
    si stava parlando della "textarea"

  7. #7
    Quote Originariamente inviata da Al_katraz984 Visualizza il messaggio
    mi sembra chiaro, il documento che stai usando non supporta l'attributo placeholder.. dovresti usare la Doctype Html5 per usarlo.
    [/FONT][/COLOR]
    Stavo guardando proprio quello oggi. Probabilmente il problema è il doctype dichiarato (e usato), poichè se lo cambio cambiano gli errori.
    Penso che la soluzione sia decidere quale versione di doctype usare e cercare di uniformare il codice a quel doctype.
    Se il form usa attributi supportati solo in html 5, provo a verificare che anche tutto il resto del codice html piaccia alla versione 5.

    Siccome sarebbe la prima pagina che faccio in html 5, faccio una domanda: c'è piena compatibilità sui browser anche se non sono all'ultima versione?

  8. #8
    Quote Originariamente inviata da ac_socmel Visualizza il messaggio
    ma non lo devi togliere da "input"
    si stava parlando della "textarea"
    Ah ok, ho capito. Infatti ora quell'errore è sparito. Ma allora la sintassi giusta è questa? Quindi faccio la stessa cosa anche nei campi di input?

  9. #9
    Ho risolto quasi tutti gli errori!

    Ho ancore questo:
    codice HTML:
    <input tabindex="4" type="oggetto" name="oggetto" id="oggetto" value="" placeholder="Oggetto" required/>

    Line 81, Column 110: Bad value oggetto for attribute type on element input.…"oggetto" name="oggetto" id="oggetto" value="" placeholder="Oggetto" required/>

  10. #10
    Quote Originariamente inviata da danbat Visualizza il messaggio
    Ho risolto quasi tutti gli errori!

    Ho ancore questo:
    codice HTML:
    <input tabindex="4" type="oggetto" name="oggetto" id="oggetto" value="" placeholder="Oggetto" required/>

    Line 81, Column 110: Bad value oggetto for attribute type on element input.…"oggetto" name="oggetto" id="oggetto" value="" placeholder="Oggetto" required/>
    Sostituendo
    codice HTML:
    type="oggetto"
    con
    codice HTML:
    type="text"
    , non ho più nessu errore, e il mio documento supera la validazione W3C con 5 warning(s).

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 © 2025 vBulletin Solutions, Inc. All rights reserved.