You need to sign in to do that
Don't have an account?

Can i enable and disable fields on a visualforce page , based on some conditions?
hi ,
Can i enable and disable fields on a visualforce page , based on some conditions?
If yes , Please let me know how ?
Thanks
Rjoshi
Hey
An example of the above suggestion might be:
public Class MyController{
public boolean enabled{get;set;}
public String blah{get;set;}
public MyController(){
enabled = true;
}
public void disable(){
enabled = false;
}
}
<apex:page>
<apex:form id="theform">
<apex:inputText value="{!blah}" disabled="{!enabled}"/>
<apex:commandButton value="disable" action="{!disable}" rerender="theform"/>
</apex:page>
Cheers,
Wes
All Answers
Yes, you can enable/disable fields & controls using public properties of its controller class.
Just create boolean public properties and bind with fields & controls and set its values as TRUE/FALSE according to your needs.
Hey
An example of the above suggestion might be:
public Class MyController{
public boolean enabled{get;set;}
public String blah{get;set;}
public MyController(){
enabled = true;
}
public void disable(){
enabled = false;
}
}
<apex:page>
<apex:form id="theform">
<apex:inputText value="{!blah}" disabled="{!enabled}"/>
<apex:commandButton value="disable" action="{!disable}" rerender="theform"/>
</apex:page>
Cheers,
Wes