You need to sign in to do that
Don't have an account?
Ursfriendly
How to add Message Class to class,Give me example
hi
Any one can help me......
How to Use Message class,to throw custom error messages on VF page?
Thank U
function readOnly(count){ }
You need to sign in to do that
Don't have an account?
hi
Any one can help me......
How to Use Message class,to throw custom error messages on VF page?
Thank U
Tryout this sample code for getting addmessage class used in apex.
VF Code:
<apex:page controller="NewAndExistingController" tabstyle="Account">
<apex:form>
<apex:pageBlock mode="edit">
<apex:pageMessages/>
<apex:pageBlockSection>
<apex:inputField value="{!Account.name}"/>
<apex:inputField value="{!Account.phone}"/>
<apex:inputField value="{!Account.industry}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save" action="{!save}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller code:
public class NewAndExistingController
{
public Account account {get; private set;}
public NewAndExistingController() {
Id id = ApexPages.currentPage().getParameters().get('id');
account = (id == null) ? new Account() :
[SELECT name, phone, industry FROM account WHERE id = :id];
}
public PageReference save()
{
try {
upsert(account);
} catch(System.DMLException e) {
ApexPages.Message myMsg = new
ApexPages.Message(ApexPages.Severity.ERROR,e.getmessage());
ApexPages.addMessage(myMsg);
return null;
}
// After Save, navigate to the default view page:
return (new ApexPages.StandardController(account)).view();
}
}
Hi,
Thanks for this...
i was posted my complete requirement to u........................please give me the reply for that...........
thank u