You need to sign in to do that
Don't have an account?

Function JS : checkbox is checked???
I have a function JS to check if a checkbox is checked, but does not work. Why?
<apex:page standardController="CronTrigger" > <style type="text/css"> .classeHoraire { width: 60px; } .classeBig { width: 600px; } .imageCenter {display: block; margin-left: auto; margin-right: auto;} </style> <script type="text/javascript"> function verify(){ var checkNomJob = '{!verifiyNomJob}'; if (document.getElementById("{!$Component.theform.block01.pageSess01.outputPane01.ckLun}").checked){ alert("Messageee"); } } </script> <apex:form id="theform" > <apex:PageBlock id="block01"> Job Name.: <apex:inputText id="nomJobIP" value="{!nomJob}" /> <br /><br /> <br/><br/> <apex:pageBlockSection columns="2" id="pageSess01"> <apex:outputPanel id="outputPane01"> <apex:inputCheckbox id="ckLun" value="{!checkLundi}" disabled="{!disableSemaineCheckModification}" />Lundi<br /> <apex:inputCheckbox id="ckMar" value="{!checkMardi}" disabled="{!disableSemaineCheckModification}" />Mardi<br /> </apex:outputPanel> </apex:pageBlockSection> ..... </apex:page>
Replace the if statement with this
if(document.getElementById("{!$Component.theform.block01.pageSess01.ckLun}").checked)
Thanks
All Answers
Follow the procuedure explained in the below article
https://www.salesforce.com/us/developer/docs/pages/Content/pages_access.htm
Can you try taking out the outputPane01 from your getElementById. Please try the below.
Thank you
Replace the if statement with this
if(document.getElementById("{!$Component.theform.block01.pageSess01.ckLun}").checked)
Thanks