+ Start a Discussion

Field update on command button click

I am trying to create two buttons that inserts Up and Down on a record by clicking a command button. Here is my code so far:
VF Page:
<apex:form id="votingSection">
                       <apex:pageBlock mode="edit">
     <apex:pageBlockButtons location="bottom">
                       <apex:commandButton styleclass="btn-lg btn-data" value="Vote Up"  action="{!voteUp}" reRender="votingSection"/>
                       <apex:commandButton styleclass="btn-lg btn-data" value="Vote Down"  action="{!voteDown}" reRender="votingSection"/>


public class detExt2 {
     private final my_object__c myObject;
            public detExt2() {
                myIdea = [SELECT Id, Vote_Button__c, Name FROM my_object__c
                           WHERE Id = :ApexPages.currentPage().getParameters().get('id')];
            public my_object__c getObject() {
                return myObject;
            public PageReference voteUp() {
                myIdea.Vote_Button__c = 'Up';
                update myObject;
                return null;
              public PageReference voteDown() {
                myIdea.my_object__c = 'Down';
                update myObject;
                return null;

Any ideas on how to make this work? Also, I'm trying to figure out how to implement unique votes by user. 

Zuinglio Lopes Ribeiro JúniorZuinglio Lopes Ribeiro Júnior

What is not working in your VF?