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
mahidhar Reddymahidhar Reddy 

how to restrict the field in vf pages

Raj VakatiRaj Vakati
You can do by using 
rendered attribute or read-only attribute 

 
<apex:outputField value="{!x.somefield__c}" rendered={!isVisible}/>

AND

<apex:inputFiled value="{!x.somefield__c}" rendered={!isVisible}/>

 
Raj VakatiRaj Vakati
Or

with the validation also you can do it 


public class checknumericvalue {
    public string name{set;get;}
    public checknumericvalue(){
        
    }
    public void check(){
        if(name.isNumeric()==true){
            apexpages.addMessage(new ApexPages.message(apexpages.Severity.WARNING,'give only characters only'));
        }
    }
}


<apex:page controller="checknumericvalue" >
    <apex:form>
        <apex:messages />
    <apex:pageBlock title="check value">
        <apex:inputText value="{!name}" />
        </apex:pageBlock>
   <apex:commandButton value="check" action="{!check}" />
    </apex:form>
</apex:page>


 
mahidhar Reddymahidhar Reddy
tanq raj..