PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Calculating a Product Field

  1. I'm creating a form for a product. When the user selects the county the live in, I want to populate 2 separate product fields, with the cost associated with their county. I know that I can use a product drop down and use the total cost associated with their county, but the customer would like the 2 costs listed separately.

    i.e - User chooses Orange County
    Exam fee = $40
    Travel fee = $100

    Can this be done with a calculated product field? Or do I need to create a function and use a hook with the onchange event (if this can be done, please point me to an example)

    Posted 11 years ago on Thursday April 18, 2013 | Permalink
  2. I've been trying to find an answer to this for a full day. I tried the following in an html field on the form: I've tried having the input listed as #input_30 and #input_3_30. I haven't worked on actually changing the field values yet, but I just wanted to see if I could get the onchange event to trigger a function. Anyone successfully do this?

    <script type="text/javascript">
    jQuery(document).ready(	function() {
    		$('#input_3_30').bind('onchange', function (){
    			CalculateFees(this.form);
    	  });
    });
    
    function CalculateFees(frm) {
            alert('here');
    
    }</script>
    Posted 11 years ago on Saturday April 20, 2013 | Permalink
  3. You could simply just use conditional logic to show/hide individual product fields based on county selection.

    Posted 10 years ago on Tuesday April 23, 2013 | Permalink