Correct total not showing up in autoresponce email

  • Profile Image
    Spade12
    Asked on August 18, 2011 at 04:12 PM

    Hey there, I succesfully modified the jotform.js to include a custom rate affecting the dynamic total on my form but its not showing up on my summary emails.   Is this a simple fix? 

  • Profile Image
    allanftd
    Answered on August 18, 2011 at 10:45 PM

    Hi Spade12,

    May we ask which part did you modify in the javascript jotform.js and also the website where your form is embedded? The risk here is that manipulating js files may affect or even impair the overall performance of your forms that's why we don't really encourage this practice unless you're an expert in Javascript.

    We'll wait for your response and we'll see if we can help you isolate the cause of the problem. Otherwise, you may have to revert back to the original scripting.

    Thank you for using JotForm!

    JOTFORM SUPPORT

  • Profile Image
    Spade12
    Answered on August 18, 2011 at 11:04 PM

    I edited jotform.js to have the following :

     

    /**
         * Calculates the payment total with quantites
         * @param {Object} prices
         */
        countTotal: function(prices){
       
            var total = 0;
            $H(prices).each(function(pair){
                total = parseFloat(total);
                var price = parseFloat(pair.value.price);
                if ($(pair.key).checked) {
                    if ($(pair.value.quantityField)) {
                        price = price * parseInt($(pair.value.quantityField).getSelected().text, 10);
                    }
                    total += price;
                }
            });
         
            var interest = .25 * total;
            if (interest < 90)
                total += 90;
            else
                total += interest;
           
            if ($("payment_total")) {
                $("payment_total").update(parseFloat(total).toFixed(2));
            }
        },
        /**
         * Sets the events for dynamic total calculation
         * @param {Object} prices
         */
        totalCounter: function(prices){
            $H(prices).each(function(pair){
                $(pair.key).observe('click', function(){
                    JotForm.countTotal(prices);
                });
                if ($(pair.value.quantityField)) {
                    $(pair.value.quantityField).observe('change', function(){
                        $(pair.key).checked = true;
                        JotForm.countTotal(prices);
                    });
                }
            });
        }, 

     

    my form is at www.avimages.com/stem11

     

    I intend to upgrade my account to at least premium

  • Profile Image
    allanftd
    Answered on August 19, 2011 at 04:11 AM

    Thanks for sharing your customized code. I'm not an expert on this subject but I believe that the javascript code does not process data on the server side. What it only does is help you perform operations such as mathematical or logical operations in order to manipulate how the data would appear on the front end such as your client's browser. Getting this to reflect in the autoresponse email (which involves server side processing) is not possible from what I know. Any new variables or objects may not be recognized by JotForm's backend. 

    In addition, you may want to give the impression that your website is secure because I observed that your form is asking for credit card information. Installing a SSL certificate for your website will be an appropriate solution. Make your form secure by using the https:// prefix in your form's URL. And most importantly, we strongly recommend that you use the Payment Tool for forms that ask for payment. This way, your customer's financial data is kept private, securely encrypted, and safe. 

    Hope our recommendations will be valuable to you. I shall keep this thread open so that my colleagues who are more experienced with Javascript can provide their own insights about this issue, or if they can suggest another workaround. If there's none, then I guess you have to revert back to the original javascript coding and discard any changes that you made. 

    Thank you for using JotForm!

    JOTFORM SUPPORT 

  • Profile Image
    Spade12
    Answered on August 19, 2011 at 08:16 AM

    Thank you for the reply, I do have the SSL certs installed and I plan on using another tool for payment processing, jotform is nearly perfect for gathering the payment information and items ordered.  

     

    This is a very time sensitive project for me, I'd be plenty willing to pay for some custom back end customization.  

  • Profile Image
    liyam
    Answered on August 21, 2011 at 04:37 AM

    I'm not good with coding in Javascript but I hope what I can share here can help you find a solution:

    Add another product and use it for fees.  Now have it hidden via CSS and have it selected automatically.  Now, find the string of the fees price and then convert it to a variable, the same varible that you use for fees at the lower part of the form.

    Let us know if this works.

    Thanks,

    Liyam

  • Profile Image
    Spade12
    Answered on August 22, 2011 at 04:00 PM

    Thanks for the suggestion Liyam, unfortunately I don't think it would work with the percentage portion of the formula.  It seems to me like the way to fix it is to edit the backend php.

  • Profile Image
    NeilVicente
    Answered on August 23, 2011 at 07:42 AM

    Hi,

    Sadly, there is no way to customize JotForm's back-end to work for your requirements. What you can do instead is to have someone work for a custom php page which will serve as your form's action URL. This solution will give you complete control over your form's back-end.

    However, it would also mean that the form is not hosted in JotForm anymore. As such, you will no longer enjoy the features that we offer such as e-mail alerts and submissions storage, among others.


    Neil