I am currently trying to create an app to track workouts and I've hit a snag.
I have a visualforce page:
<apex:page standardController="Exercise__c" extensions="ExerciseListController" recordSetVar="Exercises" sidebar="true" showheader="false">
<apex:form >
<apex:pageBlock id="ExerciseList">
<apex:pageBlockTable Value="{!Exercises}" var="e" rendered="{!NOT(ISBLANK(Exercises))}">
<apex:column HeaderValue="Add to Wod" width="60">
<apex:inputCheckbox value="{!selected[e.id]}"/>
</apex:column>
<apex:column headerValue="Exercise Name">
<apex:outputLink value="/{!e.id}" target="_blank">
{!e.Name}
</apex:outputLink>
</apex:column>
<apex:column HeaderValue="Exercise ID">
<apex:outputLink value="/{!e.id}" target="_blank">
{!e.id}
</apex:outputLink>
</Apex:column>
</apex:pageBlockTable>
<apex:outputLabel value="No record to display" rendered="{!(ISBLANK(Exercises))}" styleClass="noRowsHeader"></apex:outputLabel>
<apex:pageBlockButtons >
<apex:commandButton reRender="all" value="Save" action="{!SelectExercisesForWod}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
and a controller extension:
public class ExerciseListController{
public Map<Id, Boolean> selected {get; set;}
List<Exercise__c> Exercises;
public String WodID {get; set;}
public ExerciseListController(ApexPages.StandardSetController controller) {
}
public ApexPages.StandardSetController ExerciseListController{
get{
if(ExerciseListController == null) {
ExerciseListController= new apexPages.standardSetController(
Database.getQueryLocator(
[Select Name FROM Exercise__c]
)
);
}
return ExerciseListController;
}
set;
}
public pageReference SelectExercisesForWod(){
system.debug('test');
return null;
}
public List<Exercise__c> getExercises(){
return (List<Exercise__c>) ExerciseListController.getRecords();
}
public void setExercises(Exercise__c[] exercises){
this.exercises = exercises;
}
public List<SelectOption> getItems(){
List<SelectOption> options = new List<SelectOption>();
for(Exercise__c e : [select name from Exercise__c]){
options.add(new selectOption(e.id, e.name));
}
return options;
}
}
When I click on the commandbutton in the page the action method does not fire. Their is no redirect and the system.debug does not show "test". Any clue why?