+ Start a Discussion
bg_richardbg_richard 

Random VisualForce Div and Paragraph Warnings

We intermittently get errors displayed in the following format when our VF pages are rendered 

 

"The element type "div" should be terminated by the matching end-tag "</div>". at line 39"

 

We thought this was as side effect of having development mode on for our DE but it happens with DE off and it's still happening after deploying to a Test Edition. We also see warnings for paragraph tags too but less frequently.

 

This can't be our code as it also happens on the Page Editor  and we don't use our own base HTML on pages where the warning occurs.

 

Surely someone else has had this ? 

Message Edited by bg_richard on 08-22-2009 09:03 AM
Best Answer chosen by Admin (Salesforce Developers) 
jwetzlerjwetzler

Yes, this is a problem with warnings that are on your pages or in the components/pages included within your page.  It means you've got some untidy HTML sitting around somewhere, and it's definitely a best practice to clean that up.

 

The reason you see it intermittently is because of some caching that's coming in to play.  Only when your page is recompiled will this message happen.

 

My suggestion for tracking it down is to start with the page you're on.  Edit it and save (all you should need to do is add some whitespace to your page).  If you don't see the warning, check the components included in your page. You should be able to find the offender that way.

All Answers

BrianWKBrianWK

I've had this issue with P, div and A tags -- but it never has to do with the actual tags.

 

I've done testing on my own code, sometimes I wont' change a thing and simply refresh - and bam! error is gone. Most of the time however, I've discovered there is an error with an unclosed tag - but it's not the tag they error references.

 

For example, I forgot to close an Inputtext component that was nestled in with a bunch of other lovely tags. It said the div tag at the very top wasn't closed - but in fact it was the inputtext that needed to be closed.

jwetzlerjwetzler

Yes, this is a problem with warnings that are on your pages or in the components/pages included within your page.  It means you've got some untidy HTML sitting around somewhere, and it's definitely a best practice to clean that up.

 

The reason you see it intermittently is because of some caching that's coming in to play.  Only when your page is recompiled will this message happen.

 

My suggestion for tracking it down is to start with the page you're on.  Edit it and save (all you should need to do is add some whitespace to your page).  If you don't see the warning, check the components included in your page. You should be able to find the offender that way.

This was selected as the best answer
bg_richardbg_richard

Cheers, yep found it. We had a DIV tag started in the page and terminated in a common component. The HTML output was well formed but not the individual elements. Also had some components that had optional pageBlockSections with rendered attributes that ensured at least one was generated and had to abstract any start DIV tags to match a DIV tag outside of the pageBlockSection.

 

Oddly we still see some DIV warnings at line 36 when we use the browser page and component editor. but not when our pages are rendered to users.

 

Thanks all.