Here is a bit of javascript to show a calculated field on a form.


<script type='text/javascript'>
  /* only allow numbers to be entered */
  $('%CONTENT_ROW.ROW_ID%').find(".f119704 input[type=text]").keydown(function(e){
    if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110, 190]) !== -1 ||
             // Allow: Ctrl+A, Command+A
            (e.keyCode === 65 && (e.ctrlKey === true || e.metaKey === true)) || 
             // Allow: home, end, left, right, down, up
            (e.keyCode >= 35 && e.keyCode <= 40)) {
                 // let it happen, don't do anything
                 return;
        }
        // Ensure that it is a number and stop the keypress
        if ((e.shiftKey || (e.keyCode < 48 || e.keyCode > 57)) && (e.keyCode < 96 || e.keyCode > 105)) {
            e.preventDefault();
        }
  });
  /* do the calculation and output the results */
  $('%CONTENT_ROW.ROW_ID%').find(".f119704 input[type=text]").keyup(function(){
    var patients = parseInt($(this).val());
    var quote = (patients*104.92).toFixed(2);
    
    $(".quote-value").text("$" + quote);
    $('%CONTENT_ROW.ROW_ID%').find("input[type=hidden]").val(quote);
  });
</script>