Monday, December 28, 2009

selectCheckboxes and commandbuttons in Sales Force

Through a lot of trial and error I discovered that the use of selectCheckboxes in Apex code built for disabled all command buttons on the page from executing their code, even though they still posted back to the server.

It was a very odd thing and was easily fixed by changing to selectOptions which is what I needed instead of checkboxes anyway. I am hoping that I had some sort of error in my code that caused the issue, I am sure that others have used selectCheckboxes just fine before.

My guess is that some sort of syntactical error that Eclipse didn't catch is what caused the issue, however since it is gone now I do not plan on digging further into the matter.


  1. This comment has been removed by a blog administrator.

  2. I ran into this problem and found your post. Here's what I found:

    1) apex:selectCheckboxes returns a *list* of strings, which no database field (like multi-select) will accept in its raw form. If this component is assigning a value to an object field, it will throw an error.

    2) By using the apex:selectCheckboxes component, the on-screen error you usually get with apex:inputField is not included. So you have to add an apex:message component to reveal and confirm the problem.

    The solution is to use a custom variable in the controller that accepts List and then (if needed) translate that value to an appropriate format during the submit.

  3. That is great information, thank-you for sharing. I will have to try that out the next time I am working in SalesForce.


Please leave your thoughts, I love hearing what you got out of the post. Spam comments will be removed.