See the code below, when I click Agree I woudld expcet doSave to be called on the controller, but when I debug, I do not see the log message and I only stay on the same page.
Things I have tried: - removing disabled=true - adding/removing immediate=true - adding/removing all javascript (not shown here, since I removed) - adding a visualforce element to the form (since it might be trying to outsmart me)
None of these worked.
Here is my controller:
public with sharing class TandCAgreeController {
public _Operating_Terms_And_Condition__c tAndC {get; set;}
public TLD__c tld {get; set;}
public TandCAgreeController()
{
System.debug('got to contstructor');
tAndC = [select terms_and_condition_text__c from _Operating_Terms_And_Condition__c where is_active__c = true];
tld = new TLD__c();
}
public PageReference doSave() {
// save the ref to the agrement they agreed to
System.debug('got to save method on tandcagree');
PageReference pageRedirect = Page.StartPage;
return pageRedirect;
}
}
Here is my page:
<apex:page controller="TandCAgreeController" id="TandCAgreePage" docType="html-5.0" showHeader="false">
<apex:composition template="{!$Site.Template}">
<apex:define name="body">
<div class="container">
<h2>Please review and agree to the terms and conditions. There is an agree check box at the bottom that will allow you to agree and continue when you check it.</h2>
<br></br>
<br></br>
<apex:pageMessages />
<apex:form >
<div class="control-group">
<label class="control-label">Subject:</label>
<div class="controls">
<div id="" style="overflow-y: auto; height:100px; border: 1px solid #DDDDDD;">
<apex:outputtext value="{!tAndC.terms_and_condition_text__c}" escape="false"></apex:outputtext>
<br/>
<div ><span style="font-weight:bold;">Check to Agree:</span> <input type="checkbox" name="agree" value="agree" id="agreement-checkbox"/> </div>
</div>
</div>
</div>
<div class="control-group">
<apex:commandButton action="{!doSave}" value="Agree" disabled="true" Styleclass="btn btn-small" immediate="true"/>
</div>
</apex:form>
</div>
</apex:define>
</apex:composition>
</apex:page>