Solved

XHTML Form problem..

Posted on 2011-02-24
9
299 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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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
 
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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
replica website 2 35
Html Table looping 4 26
Using HTML5 and CSS How to place one element in front of another elemen 7 34
send email part1 9 28
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

820 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