Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Validation problem with <p> tage and asp

Status
Not open for further replies.

multichild

Programmer
Jan 28, 2006
76
GB
I have this code below:

<p>
<%
'iterate thro recordset
Do while not rsuser.eof
%>
</p>
<%
response.write rsuser("event_Day") & "&nbsp;"
response.write rsuser("event_Date") & "&nbsp;"
response.write rsuser("event_Month") & "&nbsp;" & "&nbsp;"
response.write rsuser("event_Year") & "&nbsp;" & "&nbsp;"
response.write("<span class=""5thItem"">"&"- "&rsuser("event_SoldOut")&"</span>")
rsuser.movenext

Loop

'close resources used
rsuser.close
conn.close

'clean up
set rsuser=nothing
set conn=nothing
%>

Without the <p> tag the output does not work at all, but on leaving it there I get these error messages.

document type does not allow element "p" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag. - <p>

</p>
The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case).

I just cant seem to get around it, what ever i try

 
Why do you not rather show us the parsed content. We have no idea why paragraph should not be allowed from what you've showed us.
 
Also, are you changing the page at the moment? I've had four different layouts for the bottom section when refreshing the page and up to 286 validation errors (none of which were about a erroneous paragraph tag)!

There's no point us looking at a constantly changing page...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
When you do a "view source" of your page in a browser you will see the actual HTML that the validator uses. Your page is riddled with lots of </p> tags that do not have corresponding <p> tags.

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
Well, if you go to the line number like it suggests on the validator page, you'll see that you have:
Code:
...
<p>                    

</p>                                          
Friday&nbsp;10&nbsp;February&nbsp;&nbsp;2006&nbsp;&nbsp;<span class="5thItem">- Sold Out</span>
</p>  
...
so, you open a paragraph, close it and then attempt to close it again...


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Validation occurs on the output HTML and NOT your ASP source that is generating it.

Consequently, so long as your ASP is pumping out "proper" HTML then the validator couldn't care less how it does it.

As has been asked above, show us the HTML output.

My guess is that your rsusers records contain HTML and more specifically, a </p> tag?

Foamcow Heavy Industries - Web design and ranting
Buy Languedoc wines in the UK
 
Here is the rsuser output code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
'initialise objects and variables
dim conn, strsql, rsuser, strMDBPath
set conn=server.createobject("ADODB.Connection")
set rsuser=server.createobject("ADODB.Recordset")
strMDBpath = Server.MapPath(".\db_import\EventStyle.mdb")
'direct connection
conn.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=" & strMDBPath
strsql = "SELECT * " &_
"FROM eventDisplay WHERE event_Title = 'Medieval Banquet' or event_Title='Christmas Party'"&_
"ORDER BY cdate(event_Month + ' ' + str(event_Date) + ' ' + str(event_Year)) "
rsuser.open strsql, conn
%>
 
Going back to your original post:

Code:
<p>                    
<%
    'iterate thro recordset
    Do while not rsuser.eof
%>
</p>                                          
<%
    response.write rsuser("event_Day") & "&nbsp;"
    response.write rsuser("event_Date") & "&nbsp;"
    response.write rsuser("event_Month") & "&nbsp;" & "&nbsp;"
    response.write rsuser("event_Year") & "&nbsp;" & "&nbsp;"
    response.write("<span class=""5thItem"">"&"- "&rsuser("event_SoldOut")&"</span>")
    rsuser.movenext
        
    Loop

You are opening the <p> tag BEFORE you start the loop. BUt you are closing it WITHIN the loop.
So you end up with one opening <p> and lots of closing </p> tags.

Try opening AND closing the <p> from WITHIN the loop.
Perhaps like this:
Code:
<%
    'iterate thro recordset
    Do while not rsuser.eof
%>
[COLOR=red]<p> [/color]                                         
<%
    response.write rsuser("event_Day") & "&nbsp;"
    response.write rsuser("event_Date") & "&nbsp;"
    response.write rsuser("event_Month") & "&nbsp;" & "&nbsp;"
    response.write rsuser("event_Year") & "&nbsp;" & "&nbsp;"
    response.write("<span class=""5thItem"">"&"- "&rsuser("event_SoldOut")&"</span>")
    rsuser.movenext
%>
[COLOR=red]</p> [/color]    
<%       
    Loop

Foamcow Heavy Industries - Web design and ranting
Buy Languedoc wines in the UK
 
Thanks very much, that was it.

I moved the p within the loop, and all the <p> errors went.

Thanks very much for everones help

lee
 
Yes I can see, thanks very much.

I have taken that process further, and I am now trying to stylize it the way I want, and once again I have come across new errors that dont seem to make sense.

But this time its highlighting the body tag, which I have coded properly.

This validation stuff, cant half be frustrating sometimes.

 
and this is the code

<%
'iterate thro recordset
Do while not rsuser.eof
%>
<ul>
<li>
<span class="style18">
<%
response.write rsuser("event_Day") & "&nbsp;"
response.write rsuser("event_Date") & "&nbsp;"
response.write rsuser("event_Month") & "&nbsp;" & "&nbsp;"
response.write rsuser("event_Year") & "&nbsp;" & "&nbsp;"
response.write("<span class=""5thItem"">"&"- "&rsuser("event_SoldOut")&"</span>")
rsuser.movenext
%>
</span>
</li>
</ul>
<%
Loop

'close resources used
rsuser.close
conn.close

'clean up
set rsuser=nothing
set conn=nothing
%>

</th>
</tr>
</table>
</body>
</html>
 
If you look at source on validator, you will see that you have a renegade </td> right before you close the last table. I am sure that if you get rid of that, your problems will go away.
 
I htink i saw what you mean, but didt seem to do thr trick for full validation.

Lee
 
Man, look at the source code of your page when it is rendered. Look at the errors pointed out by the validator. It is pointed out where the errors are. Just check which tables do not coincide. Here's what it looks like your end of the file should be:
Code:
	</th>
  </tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Incidentally, good code indentation will help prevent errors like these.
 
You really should clean up your HTML, too.

Why, why, why, why, why, why, why, do you have a long list of items with each item inside its own UL? You may as well not use lists at all!

The point of a list is that it CAN have multiple items. You really should change this.

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top