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

same user clicked multipulle times on button that time i don't want increment count value i need only one time count.
HI Experts
This is my reuirement.
i have Follow button. for ex: i want count avalue only one time but here same user clicked multipulle times on button that time i don't want increment count value. please help me how to i will write a logic in method.
Thanks in Advance,
Chanti
This is my reuirement.
i have Follow button. for ex: i want count avalue only one time but here same user clicked multipulle times on button that time i don't want increment count value. please help me how to i will write a logic in method.
<apex:commandButton id="CommandButton1" value="Follow" action="{!followOwner}"/> public Integer followingCount{get;set;} //Constructor public userData (ApexPages.StandardController stdController) { UserId = UserInfo.getUserId(); GetCount(); } //Method public void GetCount() { List<User> following = [SELECT Id, Name,title, SmallPhotoUrl FROM User WHERE Id =:parentsetid AND Id !=:u.id order by name]; followingCount = following.size(); }
Thanks in Advance,
Chanti
Here is what you can do to achieve this:
/***Apex Class Controller****/
public Class Test{
public integer count{get;set;}
private boolean b;
public Test(){
Count=0;
b=true;
}
public void proceed(){
ID id=Userinfo.getUserid();
if(b==true)
getcount();
}
public Void getcount(){
count=count+1;
b=false;
}
}
/****Vf Page*****/
<apex:page controller="Test">
<apex:form >
<apex:pageBlock title="Hello!">
<apex:pageBlockSection >
<apex:outputText value="{!Count}" / >
</apex:pageBlockSection>
<apex:pageBlockButtons >
<apex:commandButton Value="Proceed" Action="{!Proceed}" />
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
on clicking 'Proceed button' it will increment this count only once for current User
Thanks
please mark this answer best if it solves your problem.
Hi Chanti k,
Please find the code above it may be help you.
if it help you please select it as a best answer.
Thanks,
Enjoy Development.