Formulaire

HTML5, CSS3, Javascript, support des mobiles... Que penser de votre site ? Vous manquez d'informations pour la construction d'un site qui puisse s'afficher correctement partout ? C'est un problème simple, un peu complexe ? Venez ici !
Erwan
Arias
Messages : 16
Inscription : 24 juin 2004, 19:43

Formulaire

Message par Erwan »

Bonjour,
Dans ma page j'ai rajouté un formulaire, mais maintenant la page n'est plus valide avec le validateur du W3C
Pourtant je ne vois pas ce qu'il a d'invalide ce formulaire, et j'ai beau regardé je ne vois pas

Code : Tout sélectionner

 <form name="frmchoixCSS" method="get" >
   <input type="radio" name="choixCSS" value="1" >normale</input>
   <input type="radio" name="choixCSS" value="2" >minimale</input>
    
   <input type="Submit" value="OK"/>
   </form>
les erreurs sont aux nombres de 8 et toutes sur le formulaire.
W3C a écrit : #

Line 26, column 12: there is no attribute "name"

<form name="frmchoixCSS" method="POST" >

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.


#

Line 26, column 38: value of attribute "method" cannot be "POST"; must be one of "get", "post"

<form name="frmchoixCSS" method="POST" >

The value of the attribute is defined to be one of a list of possible values but in the document it contained something that is not allowed for that type of attribute. For instance, the “selected” attribute must be either minimized as “selected” or spelled out in full as “selected="selected"”; a value like “selected="true"” is not allowed.


#

Line 26, column 40: required attribute "action" not specified

<form name="frmchoixCSS" method="POST" >

The attribute given above is required for an element that you've used, but you have omitted it. For instance, in most HTML and XHTML document types the "type" attribute is required on the "script" element and the "alt" attribute is required for the "img" element.

Typical values for type are type="text/css" for <style> and type="text/javascript" for <script>.


#

Line 27, column 50: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<input type="radio" name="choixCSS" value="1" />Normale

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>").


#

Line 27, column 51: character data is not allowed here

<input type="radio" name="choixCSS" value="1" />Normale

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).


#

Line 28, column 50: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<input type="radio" name="choixCSS" value="2" />


#

Line 30, column 22: value of attribute "type" cannot be "Submit"; must be one of "text", "password", "checkbox", "radio", "submit", "reset", "file", "hidden", "image", "button"

<input type="Submit" value="OK" style="font-size: 9px;" />


#

Line 30, column 60: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<input type="Submit" value="OK" style="font-size: 9px;" />


#

Line 31, column 6: end tag for "form" which is not finished

</form>

Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element (e.g. 'ul') which requires a child element (e.g. 'li') that you did not include. Hence the parent element is "not finished", not complete.

Voila, je ne trouve pas mais en ce moment je suis aussi un peu KO

Je vous remerci d'avance
Dernière modification par Erwan le 28 juin 2004, 15:17, modifié 3 fois.
Bobe
Iguane
Messages : 742
Inscription : 28 juil. 2003, 21:29

Message par Bobe »

l'attribut action de la balise <form> est obligatoire et celui ci ne peut pas contenir directement des éléments en-ligne (en gros).

Code : Tout sélectionner

<form name="frmchoixCSS" method="get" action="/path/to/script">
<div>
  <label><input type="radio" name="choixCSS" value="1" /> normale</label>
  <label><input type="radio" name="choixCSS" value="2" /> minimale</label>
  <input type="Submit" value="OK" />
</div>
</form>
« La vie d’un geek est un combat perpétuel contre l’imperfection »
Erwan
Arias
Messages : 16
Inscription : 24 juin 2004, 19:43

Message par Erwan »

Oui, mais justement, je ne peux l'utiliser

j'ai fait un include, vers le fichier change_css.php, pour permettre le changement de feuille de style grâce au formulaire.

et l'attribut action ne peux être utilisé sinon ça ne marche plus
Bobe
Iguane
Messages : 742
Inscription : 28 juil. 2003, 21:29

Message par Bobe »

je vois aucune raison logique de ne pas mettre l'attribut action.
Tu peux préciser le problème ? (page d'exemple ?)
« La vie d’un geek est un combat perpétuel contre l’imperfection »
Erwan
Arias
Messages : 16
Inscription : 24 juin 2004, 19:43

Message par Erwan »

alors, pour test

sans l'attribut action à cette adresse http://www.rongeur.org

et avec l'attribut action vers le fichier en question à cette adresse http://www.rongeur.org/test/


Voila si tu as besoin de voir le cod ou autre tu n'as qu'a le demander
Bobe
Iguane
Messages : 742
Inscription : 28 juil. 2003, 21:29

Message par Bobe »

bah met l'url de la page courante dans l'attribut action et ce sera ok :\

Sinon, je vois que c'est pour changer la feuille de style. Tu devrais faire ça plutôt avec un script coté client.

Je te suggère: http://dev.webnaute.net/Applications/Switcher/
Dernière modification par Bobe le 09 janv. 2005, 12:11, modifié 1 fois.
« La vie d’un geek est un combat perpétuel contre l’imperfection »
calimo
Animal mythique
Messages : 14118
Inscription : 26 déc. 2003, 11:51

Message par calimo »

Il y a plein de choses à dire sur cette page.
Déjà elle a un doctype XHTML1.1 mais elle est envoyée en text/html ce qui est fortement déconseillé par le W3C.
Ensuite je ne sais pas comment ça peut marcher sans action. Comment le navigateur peut-il savoir qu'il faut utiliser "change_css.php" pour changer le style si tu ne le lui dit pas ? :shock:
Ensuite ton formulaire n'utilise pas l'élément label ce qui est bien dommage.
Pour method="POST", je te rappelle qu'en XHTML il faut tout écrire en minuscule :wink:
En résumé, si ça marche c'est un bug, ou plutôt un reste des vieux modes "quirk" des anciens navigateurs :wink:

Au passage, Openweb a fait un excellent article sur les formulaires que je te recommande.
bobo
Iguane
Messages : 764
Inscription : 18 août 2003, 11:04

Re: Formulaire

Message par bobo »

Erwan a écrit :Bonjour,
Dans ma page j'ai rajouté un formulaire, mais maintenant la page n'est plus valide avec le validateur du W3C
Pourtant je ne vois pas ce qu'il a d'invalide ce formulaire, et j'ai beau regardé je ne vois pas

Code : Tout sélectionner

 <form name="frmchoixCSS" method="get" >
   <input type="radio" name="choixCSS" value="1" >normale</input>
   <input type="radio" name="choixCSS" value="2" >minimale</input>
    
   <input type="Submit" value="OK"/>
   </form>
les erreurs sont aux nombres de 8 et toutes sur le formulaire.
W3C a écrit :Line 26, column 12: there is no attribute "name"

<form name="frmchoixCSS" method="POST" >

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.
il faut utiliser id à la place de name sur la balise <form>
W3C a écrit :Line 26, column 38: value of attribute "method" cannot be "POST"; must be one of "get", "post"

<form name="frmchoixCSS" method="POST" >

The value of the attribute is defined to be one of a list of possible values but in the document it contained something that is not allowed for that type of attribute. For instance, the “selected” attribute must be either minimized as “selected” or spelled out in full as “selected="selected"”; a value like “selected="true"” is not allowed.
post en minuscule, et au lieu de POST.
W3C a écrit :Line 27, column 50: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<input type="radio" name="choixCSS" value="1" />Normale

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>").


#

Line 27, column 51: character data is not allowed here

<input type="radio" name="choixCSS" value="1" />Normale

You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>) or forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes).


#

Line 28, column 50: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<input type="radio" name="choixCSS" value="2" />


#

Line 30, column 22: value of attribute "type" cannot be "Submit"; must be one of "text", "password", "checkbox", "radio", "submit", "reset", "file", "hidden", "image", "button"

<input type="Submit" value="OK" style="font-size: 9px;" />


#

Line 30, column 60: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<input type="Submit" value="OK" style="font-size: 9px;" />
En XHTML, les <input>, le texte et les éléments inline doivent être inclus dans un <div>, un <p>, etc...
W3C a écrit :Line 31, column 6: end tag for "form" which is not finished

</form>

Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element (e.g. 'ul') which requires a child element (e.g. 'li') that you did not include. Hence the parent element is "not finished", not complete.
Celui là, je ne comprends pas bien. Résoud les autres problèmes d'abord.
Edité: Je pense que le problème vient des structures de ce genre :

Code : Tout sélectionner

<input type="radio" name="choixCSS" value="1" >normale</input>
<input> est un élément vide d'après la norme. Donc il faut que tu utilise plutôt :

Code : Tout sélectionner

<input type="radio" name="choixCSS" id="choixCSS1" value="1" /><label for="choixCSS1">normale</label>
ou bien (IE le gère mal, il me semble. A vérifier) :

Code : Tout sélectionner

<label><input type="radio" name="choixCSS" value="1" />normale</label>
Les standards c'est bon, mangez en !
Flore & Sébastien
Unité dans la diversité.
calimo
Animal mythique
Messages : 14118
Inscription : 26 déc. 2003, 11:51

Message par calimo »

Pour "Line 31, column 6: end tag for "form" which is not finished", c'est le même genre que pour les head dans lesquels il n'y a pas de title, car title y est obligatoire. Donc action étant obligatoire, le il ne va pas vouloir trouver la fin tant qu'il n'a pas trouvé action.
C'est un message un peu tiré par les cheveux que nous donne le validateur.
Erwan
Arias
Messages : 16
Inscription : 24 juin 2004, 19:43

Message par Erwan »

Bonjour,

Ah oui, j'avais pas vu calimo ce probleme text/html et ne l'aurais jamais vu.
J'ai appliqué vos conseille, pour les balises en majuscule j'avais remarqué, un reflexe un peu bête puisque ça complique :lol:

donc le code donne ça

Code : Tout sélectionner

<div id="formulaire">
         <form id="frmchoixCSS" method="post" action="index.php">
          <label>
          <input type="radio" name="choixCSS" value="1" />
          normale</label>
          <label>
          <input type="radio" name="choixCSS" value="2" />
          minimale</label>
          <input type="submit" value="OK" />
        </form></div>
Beaucoup d'erreurs sont parti, en changeant l'attribut name par id par exemple, l'action je vais le faire en mettant la page en cours.

Plus que 4 erreurs, mais là elle viennent toutes du meme probleme, j'avais deja eu un tel probleme au début, mais je ne me souviens plus.
W3C a écrit :#

Line 29, column 16: document type does not allow element "label" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<label>

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>").


#

Line 32, column 16: document type does not allow element "label" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<label>


#

Line 35, column 43: document type does not allow element "input" here; missing one of "ins", "del", "h1", "h2", "h3", "h4", "h5", "h6", "p", "div", "address", "fieldset" start-tag

<input type="submit" value="OK" />


#

Line 36, column 14: end tag for "form" which is not finished

</form></div>

Most likely, You nested tags and closed them in the wrong order. For example <p><em>...</p> is not acceptable, as <em> must be closed before <p>. Acceptable nesting is: <p><em>...</em></p>

Another possibility is that you used an element (e.g. 'ul') which requires a child element (e.g. 'li') that you did not include. Hence the parent element is "not finished", not complete.

Car j'ai bien mis un calque pour inclure les divers élément qui doivent être inclut


Merci encore et deja beaucoup
Erwan
calimo
Animal mythique
Messages : 14118
Inscription : 26 déc. 2003, 11:51

Message par calimo »

C'est que tu n'a pas compris l'utilisation de l'élément label. La lecture des recommandation du W3C ne fait jamais de mal.
L'attribut for associe explicitement un label à une autre commande : la valeur de l'attribut for doit être la même que celle de l'attribut id de l'élément de commande associé. On peut associer plusieurs éléments LABEL à la même commande en créant plusieurs références via l'attribut for.
label n'entoure pas l'input. Il les fait simplement correspondre, grâce à l'attribut for. Par exemple

Code : Tout sélectionner

<label for="nom">Nom</label>
[...]
<input id="nom" />
Ainsi tu peux mettre le label à l'autre bout de la page que le input si tu veux :wink:

Dans ton cas tu peux mettre

Code : Tout sélectionner

<div id="formulaire">
  <form id="frmchoixCSS" method="post" action="index.php">
    <input type="radio" name="choixCSS" value="1" id="normale" />
    <label for="normale">normale</label>
    <input type="radio" name="choixCSS" value="2" id="minimale" />
    <label for="minimale">minimale</label>
    <input type="submit" value="OK" />
   </form>
</div>
Tu remarquera ensuite qu'en liquant sur "minimale", c'est comme si tu cliquait sur le bouton radio. L'attribut for te permet de faire un lien vers le id correspondant :D
C'est plus pratique pour tout le monde, et surtout pour les personne n'utilisant pas les médias graphiques traditionnels :wink:
Erwan
Arias
Messages : 16
Inscription : 24 juin 2004, 19:43

Message par Erwan »

Merci, beaucoup, ça marche suffisait de mettre le calque ailleur

Sinon, merci pour le lien calimo, je lirais tout ça, ça me sera utilie la prochaine fois :)

donc le code bon est

Code : Tout sélectionner

<form id="frmchoixCSS" method="post" action="index.php">
    <div id="formulaire">
    <input type="radio" name="choixCSS" value="1" id="normale" />
    <label for="normale">normale</label>
    <input type="radio" name="choixCSS" value="2" id="minimale" />
    <label for="minimale">minimale</label>
    <input type="submit" value="OK" /> 
    </div>
    </form> 

Voila merci encore, bon, je fais toutes les pages et je lis les recommandation

Encore merci @+
calimo
Animal mythique
Messages : 14118
Inscription : 26 déc. 2003, 11:51

Message par calimo »

Erwan a écrit :Voila merci encore, bon, je fais toutes les pages et je lis les recommandation
Euh... l'inverse ne serait-il pas plus logique ?
Sinon tu risque de devoir tout recommancer :lol: Je dis ça comme ça, tu fait ce que tu veux, mais c'est plus logique d'apprendre avant de faire :wink:

EDIT : et ton site n'est toujours pas correct XHTML 1.1 :wink:
Erwan
Arias
Messages : 16
Inscription : 24 juin 2004, 19:43

Message par Erwan »

Ah?
calimo
Animal mythique
Messages : 14118
Inscription : 26 déc. 2003, 11:51

Message par calimo »

Ah quoi ? :lol:
Répondre

Qui est en ligne ?

Utilisateurs parcourant ce forum : Aucun utilisateur inscrit et 4 invités