1

Apex class:

public Integer sCount {get;set;}

Attachments = [SELECT  Id,Name FROM Attachment WHERE Parentid =:caseId ];     
Integer sCount = Attachments.size();

Vf page:

<apex:commandButton disable= {!IF (sCount > 5,true,false)} value="Upload Attachments" action="{!upload}"/>
2

First, you need to enclose {!IF (sCount > 5,true,false)} with " quotes.

Second, change disable to disabled according to attributes in documentation

Third, IF(sCount > 5,true,false) equals to sCount > 5

<apex:commandButton disabled="{! sCount > 5}" value="Upload Attachments" action="{!upload}"/>
-1

Try to use below piece of code. Instead of disable it is disabled

<apex:commandButton disabled= "{!IF (sCount > 5,true,false)}" value="Upload Attachments" action="{!upload}"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.