Solved

XHTML Form problem..

Posted on 2011-02-24
9
289 Views
Last Modified: 2012-05-11
I tried validating my Contact page for DTD XHTML 1.0 Strict

and it really doesn't like my Form :-)

 
<form action="contact.php" method="post" name="benq" >
<label class="sel"  for="Name">Name:</label>
<input class="seli" name="name" type="text" id="name" size="35" maxlength="50"
                    value="<? echo $_POST['name']?>">
					<div class='info' id="inf_name"><? echo $namerr ?></div>
                    <br />

<label class="sel"  for="Email1">Email Address:</label>
<input class="seli" name="email1" type="text" id="email1" size="35" maxlength="50"
                     value="<? echo $_POST['email1']?>">
					<div class='info' id="inf_email1"><? echo $email1err ?></div>
                    <br />
					
<label class="sel"  for="Email2">Confirm Email:</label>
<input class="seli" name="email2" type="text" id="email2" size="35" maxlength="50"
                     value="<? echo $_POST['email2']?>">
					 <div class='info' id="inf_email2"><? echo $email2err ?></div>

                    <br />
					
<label class="sel"  for="Enquiry">Enquiry:</label>
<textarea name="enquiry" id="enquiry" class="seli" rows="3" cols="40"
 				 ><? echo $_POST['enquiry']?></textarea>
 <fieldset> 				    <div class='info' id="inf_enq"><? echo $enqerr ?></div>
                    <br />
                   
<label></label><div id="security"><? require_once('recaptchalib.php');
$publickey = "6xxxxxxxxxxxxxxxxxxxxxxxxxxxxxudKFagv9pQ8J2"; // you got this from the signup page
echo recaptcha_get_html($publickey); ?>
</div>
                  
<label></label>     <div class='info' id="inf_name"><? echo $imagerr ?></div>
                    <br />
					
<label></label>	  										
<input class='brk' type="submit" name="submit" value="Send">
<input class='brk' type="reset" value="Clear Form">
  </fieldset>
<br>
</form>

Open in new window


Help!! :-)
0
Comment
Question by:chrisfixit
  • 4
  • 3
  • 2
9 Comments
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34971233
Can't you simplify our work a bit and let us know what errors told you the parser your page has?
0
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 34971302
If you are copying and pasting code into the validator, then remember that you can't validate php code.  You see all of the <? ... ?> code snippets... that's PHP code.  

You have to pull up that PHP page in a browser window, view source, copy that code, and validate it.
0
 
LVL 1

Author Comment

by:chrisfixit
ID: 34971478
a few of the errors... the rest are similar..

Line 64, Column 47: there is no attribute "name"
<form action="contact.php" method="post" name="benq" >

Line 65, Column 31: document type does not allow element "label" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
<label class="sel"  for="Name">Name:</label>

Line 67, Column 29: 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
                    value="">

Line 69, Column 26: document type does not allow element "br" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
                    <br />
¿
The mentioned element is not allowed to appear in the context in which you've placed it;

Line 71, Column 33: document type does not allow element "label" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
<label class="sel"  for="Email2">Email Address:</label>

The page was validated from the server, not copy and paste :-).
0
 
LVL 14

Accepted Solution

by:
Designbyonyx earned 500 total points
ID: 34971858
Wrap everything in your form with a div, or even more semantic use a "fieldset" and post back the results.  If you can provide a url, that would help ;)

<form>
<fieldset>
....Existing content....
</fieldset>
</form>
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 1

Author Closing Comment

by:chrisfixit
ID: 34972143
had to modify recapchalib as well as it is non-compliant.
0
 
LVL 19

Expert Comment

by:Bardobrave
ID: 34972144
Add the <fieldset> inside the <form> for comply with hyerarchical structure of forms.

Also, <form> tag seemly doesn't have a "name" attribute, use "id" attribute instead.

If you continue receiving errors after that paste them here.
0
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 34972217
Form tag DOES have a name attribute:

http://www.w3schools.com/tags/att_form_name.asp
0
 
LVL 1

Author Comment

by:chrisfixit
ID: 34972385
Well it doesn't like the name tag at all.. I went on this..

http://www.pixelmill.com/support/support_article.aspx?ParentListID=al1095&articleid=kb101700
0
 
LVL 14

Expert Comment

by:Designbyonyx
ID: 34972656
toche my friend.  I personally use IDs and stopped using Name attributes years ago... so I have never encountered this error since I switched to XHTML.  Thanks for the clarification.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now