Activity Forums Salesforce® Discussions how to set Button enable and disable mode Reply To: how to set Button enable and disable mode

  • Shubham

    August 29, 2017 at 8:03 am

    Hello Uday


    public class sampleCon {
    public String selectedImage{get;set;}

    public sampleCon(){
    selectedImage = '';
    public PageReference test() {
    return null;

    public List<SelectOption> getItems() {
    List<SelectOption> Images = new List<SelectOption>();
    Images.add(new SelectOption('hyd','hyd'));
    Images.add(new SelectOption('che','che'));
    Images.add(new SelectOption('bng','bng'));
    return Images;

    public String getImage() {
    return selectedImage;

    public void setImage(String selectedImage) {
    this.selectedImage = selectedImage;


    <apex:page controller="sampleCon">
    <apex:selectList value="{!selectedImage}" multiselect="true">
    <apex:selectOptions value="{!Items}"/>
    <apex:commandButton value="Test" action="{!test}" rerender="out" status="status"/>
    <apex:outputPanel id="out">
    <apex:actionstatus id="status" startText="testing...">
    <apex:facet name="stop">
    <apex:commandButton value="Submit" disabled="{!If(selectedImage == '',True,False)}"/>