I have a simple form , which has a output panel and pageMessage inside it .
<apex:form>
<apex:outputPanel id="errorPanel">
<apex:message id="msg" />
</apex:outputPanel>
</apex:form>
I have visual force remoting function which returns a json result object containing message, errorCode if there is error, and other key/value parameters. Now once this json object is returned, there is a call back function which must display the error message on the screen if there is an error. How can i display the error message using the global $Component syntax? I am trying to set the title of the message as shown below, but I get this error:
"Cannot set property 'title' of null" .
function handleresult (result,event){
if(!result.success){
//display error message
var element = document.getElementById('{!$Component.errorPanel.msg}');
element.title = result.message;
return;
}
Please help me out solving this issue??
!in'{$Component.errorPanel.msg}'or is it a mistake while posting?formas well and use the full path!$Component.theForm.errorPanel.msg. Ifformhas parents(other than the<apex:page>) give ids for them as well and use the full path