You need to sign in to do that
Don't have an account?
TylerBrooks
How to get submit button to be enabled after checkbox is checked on page?
I have some code for a page and I have it to where the submit button is greyed out if a checkbox is unchecked. However whenever you check the box it doesn't enable the submit button like i'm wanting.
Here is my code
And here is the page:
Here is my code
<apex:page standardController="RMA__c"> <apex:form > <apex:outputPanel id="thePanel" rendered="{!(RMA__c.RLI_has_QUOTE_SO__c == true)}"> <apex:pageBlock title="Confirm Information" mode="edit"> <apex:pageBlockSection title="Confirm the new field values" columns="2" rendered="{!(RMA__c.Show_the_box__c == true)}"> <apex:outputfield value="{!RMA__c.Contact__c}"/> <apex:outputfield value="{!RMA__c.Shipping_Priority__c}"/> <apex:outputfield value="{!RMA__c.Ship_to_Address__c}"/> <apex:outputfield value="{!RMA__c.Bill_to_Address__c}"/> <apex:inputfield value="{!RMA__c.Request_Priority__c}"/> <apex:inputField value="{!RMA__c.Changes_are_reviewed__c}"/> </apex:pageBlockSection> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Submit" disabled="false" rendered="{!(RMA__c.Changes_are_reviewed__c == true)}"/> <apex:commandButton action="{!save}" value="Submit" disabled="true" rendered="{!(RMA__c.Changes_are_reviewed__c != true)}"/> </apex:pageBlockButtons> </apex:pageBlock> </apex:outputPanel> </apex:form> </apex:page>
And here is the page:
The reason it wasn't work was because I was adding the onchange to the same line as the input field value for the checkbox, not doing the action Support in a seperate line like shown in my correct code.
Hope this helps others!
-Tyler
All Answers
VF:
<input type="checkbox" id="checkme"/> <input type="submit" name="sendNewSms" class="inputButton" disabled="disabled" id="sendNewSms" value=" Send " />
Java Script:
var checker = document.getElementById('checkme');
var sendbtn = document.getElementById('sendNewSms');
// when unchecked or checked,run the function
checker.onchange = function(){
if(this.checked){
sendbtn.disabled = false;
} else {
sendbtn.disabled = true;
}
}
Try this piece of code.
Hope this will help you.
Thank you.
So I added the code in but when I try to hit the submit it doesn't save the record or do anything, the primary function I'm hoping for it to do is check a checkbox but when I do an onclick it doesn't check the checkbox.
Here is the code
The reason it wasn't work was because I was adding the onchange to the same line as the input field value for the checkbox, not doing the action Support in a seperate line like shown in my correct code.
Hope this helps others!
-Tyler