You need to sign in to do that
Don't have an account?
shrey.tyagi88@tcs.com
Error message appearing twice in vf page!!!Please Help!!!!!
Hi,
I have this field (xyz)of type input text area on my visualforce page as <apex:inputField value ="{!Opportunity.xyz__c}"/>. If i give characters more than the default limit of text area type, Then it gives an error message , which should happen. But instead of one I am getting two error messages below that field. Can anyone please suggest me a way to rectify this issue?
Can you post here what kind of messages you are getting?
This message is appearing just beneath the field.
• You can't use more than 32,768 characters.
• You can't use more than 32,768 characters.
Hi,
If you are using any controllers, this code give a brief idea.
Salesforce Documentation says,
ApexPages.Message myMsg = new ApexPages.Message(ApexPages.severity, summary, detail);
**where ApexPages.severity is the enum that is determines how severe a message is, summary is the String used to summarize the message, and detail is the String used to provide more detailed information about the error.
So according to salesforce there should be two parameters summary and detail. but if you skip the detail parameter, then it will displaysummary twice (not mentioned in documentation).
This expression display error message twice
apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.info, 'YOUR ERROR MESSAGE' )) ;
This expression display error message only once :smileywink:
apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.info, 'YOUR ERROR MESSAGE' , '' )) ;
Regards..
Hi,
Let me begin this by thanking you for your time and effort. Though the suggestion provided by you is quite useful for future references , it's not very much relevant to the issue here. The reason i say this is because, the error messages are nowhere coded in my controller , nor are they coming from validation rules . Its the error message that displays when your input exceeds the length of the field. So I am not very sure, how I will be able to control it in my controller. The only modification I have done is on my vf page where I have added <apex:messages/> tag at the top to display the messages.
shrey.tyagi88@ I had the same problem although my issue was due to a message created within the controller. I think you need to add the page messages but ensure that the showDetail is set to false e.g.
<apex:pageMessages showDetail="true" />
I tried showdetail=false its not working!!!!
Hi Shrey,
How did you end up resolving the issue? I am facing a similar kind !!!
Even i was facing the same issue and after checking at the known issues i found this.
https://success.salesforce.com/issues_view?id=a1p3A0000008gGUQAY
Workaround provided is use the Version 28 . As this issue exists in teh versions after 28.
Here is the fix !
Background : This is a very stange behaviour on <apex:inputField> with required="true" attribute and using ApexPages.Message
Root Cause : Visualforce is treating "inputField" and its parameter "label" as two different elements and hence two messages.
Code with Issue : (Where the message will display twice)
Fix :
if this resolves your issue, thumbs up to vote the answer !
regards,
Sid
http://siddharthsinha.in (http://siddharthsinha.in" target="_blank)
Thank your for posting this.
<apex:messages />
<apex:pageMessages />
Removing one resolved my issue