Solved

XHTML Form problem..

Posted on 2011-02-24
9
292 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Bootstrap more than 12 columns in row 3 37
jquery easyautocomplete for mutiple text boxes 9 54
Form not operating correctly. 1 22
Enter key on html form page 11 46
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

911 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

20 Experts available now in Live!

Get 1:1 Help Now