+ Start a Discussion
Abdullah Sikandar 15Abdullah Sikandar 15 

VF buttons

Here is my question please help me :

 <!-- <apex:commandButton action="{!onSend}" disabled="{!sendDeActive}" value="Send Text Message" /> -->
  <apex:commandButton rendered="{!(SMScount >= 2)}" disabled="{!sendDeActive}"  action="{onSend}" value="Send Text Message"  />
                  <apex:commandButton rendered="{(SMScount >= 3) || (!optOut) ||(desplayError = True ) }" action="{onClear}" value="Clear"  />

I have 2 buttons as you see above:
Send Text Message

Clear and Send Text message should not be shown if the SMSCount=>3, (SmsCount is a label field which is running and incrementing +1 everytime when you send message).

I tried to write a code please help me in that peice of code that it will not show us the these two buttons if the Smscount>=3, or whenever its going to be after the 3 it will not show the these buttons, please help  me i am very new in it

Wrap the buttons individually inside output panel and then rerender the output panel using the ids (sendtxt and clearbtn)

<apex:outputPanel id="sendtxt">
    <apex:commandButton rendered="{!(SMScount >= 2)}" disabled="{!sendDeActive}"  action="{onSend}" value="Send Text Message"/>

<apex:outputPanel id="clearbtn">
    <apex:commandButton rendered="{(SMScount >= 3) || (!optOut) ||(desplayError = True ) }" action="{onClear}" value="Clear"/>

Bharathimohan Ramamurthy
Salesforce For All (http://salesforceforall.blogspot.com/)
Shashikant SharmaShashikant Sharma
to make these buttons not rendered if SMSCount >= 3 then use NOT

rendered="{!NOT(SMScount >= 3)}"

you could optionally use < operator

rendered="{!SMScount < 3}"