I am trying to show/hide a submit button on my VF page based on a checkbox but its not rendering.
Here's what I have already tried:
On the controller I have defined the boolean condition as shown below:
public Boolean visibleSubmit { get; set; }
Then I have added this script below to my VisualForce Page:
function termsAccepted() {
if (document.getElementById('tncs').checked) {
visibleSubmit = true;
} else {
alert("You did not accept the terms and conditions.");
visibleSubmit = false;
}
}
Then on the checkbox and button I have set it as follows:
<apex:inputCheckbox id="tncs" required="true" onclick="termsAccepted()" value="{!partnerAgreement}"/>Terms and Conditions</p>
<apex:commandButton styleClass="btn" value="Submit" id="recordSubmit" rendered="{!visibleSubmit}" action="{!insertRecord}"/>
Many thanks for the assistance...
visibleSubmit
correct? You're not passing the value of the JSvisibleSubmit
to the Apex one?