function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
The KnightThe Knight 

Irrevelant message is getting displayed when I use ApexPages.addmessage()

 I am using

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error,'Please Enter atleast four Characters'));

 to display error message. The error message is getting displayed properly based on the condition. 

  But the following warning message is also getting dislayed some times.

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

 

This is not required. How to avoid this warning message on the screen? 

Arvind1Arvind1

Hi,

 

I assume that you are using html tags in your VF page.

I faced the same errors previously.

The conclusion is you have to resolve all the html errors when using add message because all the

html warnings will be displayed when the page message method is called.

 

Thanks

Arvind

Anup JadhavAnup Jadhav

Hi Knight,

 

I'd probably check the visualforce html to see if there are any tags which aren't closed properly.

 

- A J

JimRaeJimRae

I have noticed this "symptom" more when I am in dev, and have development mode turned on.  Frequently, the message is pointing at tags on line numbers that are beyond the range of my custom page.

 

You could try turning off development mode to see if the error clears up.  And then, just be cautious that you actually test with development mode off to make sure there are no real markup errors.

The KnightThe Knight

Thanks Jim. But in my case even if the  development mode is switced off I am getting the html errors. I have checked all the component files included in the page but not abble to find the mismatch. I am thinking of avoiding ApexMessages and start using custom defined messages. Like printing the string using apex:outputText.

 

Thanks

Joseph