Web Design Forum: The same error when validating on W3C - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

The same error when validating on W3C <tr> tags

#1 User is offline   jame5payne 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 48
  • Joined: 02-December 11
  • Reputation: 0

Posted 27 January 2012 - 03:41 PM

Good afternoon all.

Would anyone be able to give me some tips or advice on the following as I keep getting the same errors when validating on W3C..attached is a screen dump of part of the finished form.

ERROR = Line 127, Column 4: document type does not allow element "tr" here
ERROR = Line 131, Column 4: document type does not allow element "tr" here

122      <tr><td>Address</td></tr>
123      <tr>
124      <td class="input">
125      <input type="text" name="house" class="detail" tabindex="2" /><div class="context">House name/no</div></td>
126      <td class="input"><input type="text" name="street" class="detail" tabindex="3" /><div class="context">Street</div></td>
127      <tr>
128      <td class="input">
129      <input type="text" name="town" class="detail" tabindex="4" /><div class="context">Town</div></td>
130      <td class="input"><input type="text" name="city" class="detail" tabindex="5" /><div class="context">City</div></td>
131      <tr>
132      <td class="input">
133      <input type="text" name="postcode" class="detail" tabindex="6" /><div class="context">Postcode <span class="required">*</span></div></td>
134      </tr>

AND

ERROR = Line 137, Column 4: document type does not allow element "tr" here
ERROR = Line 138, Column 4: document type does not allow element "tr" here

137      <tr><td>Phone <span class="required">*</span></td></tr>
138      <tr>
139      <td class="input"><input type="text" name="phone" class="detail" tabindex="7" /></td></tr>

And it goes on and on and on and on and well, you get the jist.

Many thanks

James

Attached File(s)


This post has been edited by Renaissance-Design: 27 January 2012 - 03:41 PM
Reason for edit: Please use the code button or tags to format your code.

0

#2 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,592
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 27 January 2012 - 03:42 PM

You haven't closed your <tr>. The reason it's throwing a hissy fit is you're trying to put a row within a row, which of course is invalid.

Also, I don't see a table there, so why are you using one? Tables are deprecated for layout.

This post has been edited by Renaissance-Design: 27 January 2012 - 03:45 PM

0

#3 User is offline   jame5payne 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 48
  • Joined: 02-December 11
  • Reputation: 0

Posted 27 January 2012 - 04:09 PM

Damn them <tr> tags! I've been looking over and over that for the last 10 minutes, think I need a bigger screen, thanks Renaissance, much appreciated.

Originally I hadn't used a table Renaissance, I designed and laid out the form using 2 columns and floating them side by side BUT when the form was being sent only the column with the submit button was sending. I went into php forum on here and asked the question and I was told to stick it into a table?? As I'm new to web design I'm taking what I'm being told on here as gospel...maybe I shouldn't. :search:

But thanks for your help,

James
0

#4 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,592
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 27 January 2012 - 04:12 PM

Your problem with the two columns was trying to use two separate <form> containers. A form can contain other block-level elements for layout, so you could do:

<form>
  <fieldset class="column">
    // First column contents
  </fieldset>
  <fieldset class="column">
    // Second column contents
  </fieldset>
</form>


.column {
  width: 50%; 
  float: left;
}

This post has been edited by Renaissance-Design: 27 January 2012 - 04:15 PM
Reason for edit: Semantics

0

#5 User is offline   FizixRichard 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 325
  • Joined: 05-October 07
  • Reputation: 47
  • Gender:Male
  • Location:Market Deeping, England
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 27 January 2012 - 04:13 PM

Where is that thread or paste your code from the original form. Sticking it in a table isn't the answer, lol, whoever told you to do that shouldn't be giving advice. haha

You shouldn't be using tables for layout, tables are for... erm... tables, like a table of items and sizes. Not for laying your site out, its a nasty approach to laying out content and websites.

So paste up the original code and see if someone can figure it out for you.

Edit: I see Renaissance-Design has fixed it for you.

This post has been edited by FizixRichard: 27 January 2012 - 04:14 PM

0

#6 User is offline   jame5payne 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 48
  • Joined: 02-December 11
  • Reputation: 0

Posted 27 January 2012 - 04:21 PM

Hi FizixRichard.

If the response isn't saying use a table then I've read it completely wrong and I apologise

This was the reply...

You can only submit to one form at a time so as you have created a new form in each column, only the one with the associated submit button will work.

If you want to keep the format you need to do something like this:
<form id="quote" method="post" action="contact1.php ">
<table>
<tr><td>Form field on left column</td><td>Form field in right column</td>
<tr><td>Form field on left column</td><td>Form field in right column</td>
<!-- And so on for all for table rows and form fields -->
<tr><td>Leave blank??</td><td>Put submit button here</td></tr>
</table>
</form>

James
0

#7 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,592
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 27 January 2012 - 04:30 PM

That answer did say use a table, but it's bad advice.
0

#8 User is offline   FizixRichard 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 325
  • Joined: 05-October 07
  • Reputation: 47
  • Gender:Male
  • Location:Market Deeping, England
  • Experience:Advanced
  • Area of Expertise:Web Designer

Posted 27 January 2012 - 04:30 PM

Oh right, well the example as a table isn't a good idea. It shouldn't be in a table though, use div's, as RD has shown in his example.


I'll chime up with a random tip:
If you haven't done so already, look up HTML 5 input field types (i.e. email and number) as they are useful (if you are already doing that then great).
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users