function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
JBirkJBirk 

Vote Standard Label Error

When using the vote component on a VF page, I'm getting an error that $StandardLabel.voteButton.promote is not defined.  Anyone know why this wouldn't be defined, since it's a StandardLabel and how to fix it?

Best Answer chosen by Admin (Salesforce Developers) 
JBirkJBirk

We did figure out, sorry for not posting the solution earlier.

 

The label error is a red herring.  Figured it out by comparing the apex debug logs to the native Idea pages, which worked fine, and the VF ones, which threw the error.  

 

The problem is that if you don't set a rerender on the vote component, it will resubmit to your main controller.  On our pages, we list out recent and popular ideas, and so the idea being voted on was being promoted/demoted at the same time the list was being generated.  While I never got a real error message, my guess is that the idea was being updated at the same time the lists were being accessed.

 

Add an output panel around your vote component, slap an ID on it and set the rerender to that - and you should be fine.

All Answers

adam_purkissadam_purkiss

Me too!  Hoping someone can help with this issue soon.  I tried driving votes through a custom controller with no lock and found the same issue when resorting to the standard <apex:vote .../> component.  Apparently Starbucks found a way to do this since they have a completely custom idea layout and permit voting on them as well.

 

Good luck!

Adam

JBirkJBirk

We did figure out, sorry for not posting the solution earlier.

 

The label error is a red herring.  Figured it out by comparing the apex debug logs to the native Idea pages, which worked fine, and the VF ones, which threw the error.  

 

The problem is that if you don't set a rerender on the vote component, it will resubmit to your main controller.  On our pages, we list out recent and popular ideas, and so the idea being voted on was being promoted/demoted at the same time the list was being generated.  While I never got a real error message, my guess is that the idea was being updated at the same time the lists were being accessed.

 

Add an output panel around your vote component, slap an ID on it and set the rerender to that - and you should be fine.

This was selected as the best answer
adam_purkissadam_purkiss
Thank you JBirk - that works great!! I changed my VF code to the following and it works now:
adam_purkissadam_purkiss

 

<apex:outputPanel id="thevotepanel">
    <apex:vote id="thevote" objectId="{!ideaid}" rerender="thevotepanel"/>
</apex:outputPanel>