5 Replies Latest reply on Mar 19, 2013 6:50 AM by Ness_quick

    Calculation rule

    Ness_quick Level 1

      So what i would like to achieve is in my estimator, in the "Choice of coffin" section, in order for the Additional services' (drop down menu) to calculate, the radio button (above) for 'Simple Basic coffin' has to be selected. Basically those additional services are only available if the basic simple coffin is chosen.


      I just cant get my head around how to restrict that drop down calculation from happening if simple basic not chosen.




      Any help appreciated!

        • 1. Re: Calculation rule
          kennethkawamoto2 Level 5

          You can disable <select> with disabled attribute.



          Kenneth Kawamoto


          • 2. Re: Calculation rule
            MurraySummers Level 8

            Try this - add the following bold code to your javascript in the indicated location -


            cemetery_fee = Number(document.catwebformform22057.CAT_Custom_76931.value)


            zz=document.getElementById('CAT_Custom_76926_0').checked==true;if(zz) { document.getElementById('basicServices').style.display='block'; } else { document.getElementById('basicServices').style.display='none'; };


            Then change this -


            <select name="CAT_Custom_00010"


            to this -


            <span id="basicServices"><select name="CAT_Custom_00010"


            and this -


            <option value="545" >Limousine,Chapel visiting, Choice of date & time (&pound;545)</option>



            to this -


            <option value="545" >Limousine,Chapel visiting, Choice of date & time (&pound;545)</option>




            Finally, add this to your CSS -


            #basicServices {




            See if that does what you want.

            • 3. Re: Calculation rule
              Ness_quick Level 1

              Excellent that works really well. Thank you!


              Im trying created a php file (estimate-to-email.php) to go with this page so that all the information that is selected including the values of those selections is sent in an email. BUT! Im not sure how to collect the informations in the sections that only calculate if chosen for example - The 'Additional services' just created, 'Burial' (plus all the info within this section) and 'Cremation' (again plus all the info within this section)?


              This is what ive created so far. (ive left out the sections that im not sure about)





                        //This page should not be accessed directly. Need to submit the form.

                        echo "error; you need to submit the form!";


              $CAT_Custom_76922 = $_POST['CAT_Custom_76922'];

              $CAT_Custom_00000 = $_POST['CAT_Custom_00000'];

              $CAT_Custom_76926 = $_POST['CAT_Custom_76926'];

              $CAT_Custom_76924 = $_POST['CAT_Custom_76924'];

              $CAT_Custom_76927 = $_POST['CAT_Custom_76927'];

              $FirstName = $_POST['FirstName'];

              $LastName = $_POST['LastName'];

              $EmailAddress= $_POST['EmailAddress'];

              $HomeAddress = $_POST['HomeAddress'];

              $HomeCity = $_POST['HomeCity'];

              $HomeState = $_POST['HomeState'];

              $HomeZip = $_POST['HomeZip'];

              $HomeCountry = $_POST['HomeCountry'];

              $HomePhone = $_POST['HomePhone'];

              $CellPhone = $_POST['CellPhone'];





              //Validate first

              if(empty($CAT_Custom_76922)||empty($CAT_Custom_00000)||empty($CAT_Custom_76926)||empty($CA T_Custom_76924)||empty($CAT_Custom_76927)||empty($FirstName)||empty($LastName)||empty($Ema ilAddress)||empty($HomeAddress)|empty($HomeCity)|empty($HomeState)|empty($HomeZip)|empty($ HomeCountry)|empty($HomePhone)||empty($CellPhone))


                  echo "Please make sure all fields are filled in!";







                  echo "Bad email value!";





              $email_from = '$EmailAddress';//<== update the email address

              $email_subject = "Estimate from M&D website";

              $email_body .= "Name: $FirstName.\n";

              $email_body .= "Surname: $LastName.\n";

              $email_body .= "Address: $HomeAddress.\n";

              $email_body .= "City: $HomeCity.\n";

              $email_body .= "County: $HomeState.\n";

              $email_body .= "Postcode: $HomeZip.\n";

              $email_body .= "Country: $HomeCountry.\n";

              $email_body .= "Phone: $HomePhone.\n";

              $email_body .= "Mob: $CellPhone.\n";

              $email_body .= "Removal milage: $CAT_Custom_76922.\n";

              $email_body .= "Viewing: $CAT_Custom_00000.\n";

              $email_body .= "Coffin: $CAT_Custom_76926.\n";

              $email_body .= "Route: $CAT_Custom_76924.\n";

              $email_body .= "Limousines: $CAT_Custom_76927.\n";






              $to = "Ness_Rob@yahoo.com";//<== update the email address

              $headers = 'From: '.$EmailAddress."\r\n";

              $headers .='Reply-To:'.$EmailAddress."\r\n";

              //Send the email!


              //done.  redirect to payment page.

              header('Location: thankyou_estimate.html');



              // Function to validate against any email injection attempts

              function IsInjected($str)


                $injections = array('(\n+)',








                $inject = join('|', $injections);

                $inject = "/$inject/i";



                  return true;




                  return false;





              • 4. Re: Calculation rule
                MurraySummers Level 8

                Why don't you post this in a separate thread? That way you can mark my answer as correct in this one!

                • 5. Re: Calculation rule
                  Ness_quick Level 1

                  Okey Dokey will do!!