function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
DritterDritter 

visualforce and javascript alert

I have two fields on a visualforce page. The first allows a customer to check a box for installment billing. The second is a checkbox to accept the terms and condition of installment billing. I'm trying to write javascript that will alert the customer that they need to accept the installment billing terms and conditions if they checked the first box. This alert will happen when they hit the "Submit" button but failed to check the second box. 


I can't get it to work. Any ideas?
 
<!---Installment Billing Flag--->
                            <apex:inputField required="False" value="{!Case.Aoc_Installment_Billing__c}" label="Sign Up for Installment Billing" id="acceptInstallments_chk" >
                                <a href="#" class="tooltip">(See Terms and Conditions)<span>At Kaplan, you may select to pay for your enrollments in three installments. By selecting this option you agree: A $25 one-time, non-refundable Installment Billing Registration fee will be charged. Your first installment will be larger and will include 1/3 of tuition, the Registration fee, any applicable tax, Application fee if necessary and shipping and handling charges. Additionally you authorize that the remaining two installment payments (each 1/3 of the tuition) will be charged to the same credit card provided approximately 30 days and 60 days after the first payment. Please note that Installment Billing is not available for all products or services.</span></a>
                            </apex:inputField>
                            <!---Installment Billing Flag--->
                            <apex:inputField required="False" value="{!Case.Accept_IB_Terms__c}" label="Accept Installment Billing Terms and Conditions?" id="acceptInstallmentsTermsConditions_chk">
                                <a href="#" class="tooltip">(?)<span>At Kaplan, you may select to pay for your enrollments in three installments. By selecting this option you agree: A $25 one-time, non-refundable Installment Billing Registration fee will be charged. Your first installment will be larger and will include 1/3 of tuition, the Registration fee, any applicable tax, Application fee if necessary and shipping and handling charges. Additionally you authorize that the remaining two installment payments (each 1/3 of the tuition) will be charged to the same credit card provided approximately 30 days and 60 days after the first payment. Please note that Installment Billing is not available for all products or services.</span></a>
                            </apex:inputField>

Button 

​<apex:actionFunction name="validateInApex" action="{!ReadFile}"/>
                    <input type="button" onclick = "isIbBoxChecked();" value="Submit" id="theButton" style="width:100px;" />
                        </center>
                    </apex:outputPanel>
                </apex:pageBlock>

JavaScript

<script> 
            function isIbBoxChecked(){
                var myCheckBox = document.getElementById('{!acceptInstallments_chk.?})');
                alert('isIbBoxChecked: acceptInstallments_chk='+ myCheckBox);
                if (myCheckBox.checked){
                    alert('The Installment Billing Flag is checked'); 
                } else {
                    alert('Submitting');
                    ReadFile();
                }
            }
            //var myCheckBox = document.getElementById("acceptInstallments_chk");
            </script>