[SalesForce] apex:pageMessages includes the entire component tree path for a apex:inputText with required=”true”

I have a Visualforce page that contains an apex:inputText with required="true". It is nested within several component levels, such as a apex:pageBlockSectionItem, apex:pageBlockSection, apex:pageBlock and apex:form.

If I submit the form without entering a value I get the following output in the apex:pageMessages:

apex:pageMessages with entire component tree path for required inputText

Error: mediaPage:mediaPageBlock:mediaForm:dropBlock:requiredElementsSection:goalsSectionItem:goals: Validation Error: Value is required.

The component tree path is meaningless to the users.

Is there anyway to reformat this message or do I need to drop the required attribute on the inputText and validate the input myself in the controller?

Best Answer

Try adding a label attribute to the inputText field - if there is no label, the error will display the whole tree, but with a label, it should just display the label + error message