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
kirankumarreddy punurukirankumarreddy punuru 

how to display error message next to text field using apex class

Hi ,
    Iam validating a text field and displaying error message when the condition fails , right now it is showing error at top of page i need to show next to field how can i acheive this my condition is like this..

if(oli.Discount > 100){
             ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR, 'Discount should be in between 0 to 100.'));
             PageReference pa = new PageReference('/apex/OLIeditAll?ids='+ IdString);
             return pa;
Chandra Sekhar CH N VChandra Sekhar CH N V
Try using <apex:pageMessage summary="yourmsg" rendered="yourcondition" /> on VF page.
salesforce mesalesforce me
Hi Reddy checkit once...
<apex:pageBlock id="myblock">
       Email  <apex:inputText value="{!email}" id="email"/><br/><br/>
        <apex:commandButton value="Click me!"  action="{!checkEmail}"/>

public void checkEmail()
        if(!Pattern.matches('[a-zA-Z0-9._-]+@[a-zA-Z]+.[a-zA-Z]{2,4}', email))
            ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, 'Check your email')); 

kirankumarreddy punurukirankumarreddy punuru
ok i will check it and let u know if there is any issue
kirankumarreddy punurukirankumarreddy punuru
It is Showing an error saying that  Unknown method 'OpportunityLineItemStandardController.checkBuffer()'