I'm displaying a checkbox and a button on a Visualforce page. Upon clicking on the button, I want a checkbox field on a record (the current user's User record) to be updated with the value in the checkbox field on the Visualforce page and then take the user to another page. Here's the code I've currently got:
VF Page --
<apex:form>
<apex:inputCheckbox label='By checking this box, you agree to our Terms and Conditions.'>
</apex:inputCheckbox >
<apex:commandButton value='Agree' action="{!updateUser}">
</apex:commandButton>
</apex:form>
Controller --
public PageReference updateUser() {
Boolean acceptedCheckbox;
User currentUser = [select Id, Accepted_Legal_Terms__c from User where Id = :UserInfo.getUserId() ];
currentUser.Accepted_Legal_Terms__c = acceptedCheckbox;
update currentUser;
PageReference p;
p = new PageReference('/apex/CC_Home');
return p;
}
However, I am running into issues when trying to save the VF page, stating "Unknown property 'Controller.acceptedCheckbox'". Anyone have a guess as to what I'm missing here? Also, is the code I've laid out even the best way to handle this?