You are viewing limited content. For full access, please sign in.

Question

Question

Report does not contain the value of a calculated field

asked on May 29, 2015

I have a form that uses javascript to calculate the value of a field based on other fields on the form.  For example, the user enters a Beginning Mileage value and an Ending Mileage value and javascript calculates the difference and populates a Miles Driven field.  When users enter data in the form, the calculations are done and display correctly.  However, after the form has been submitted (Completed) and a report is produced (a csv of XLSX), the values for the calculated fields are blank.  

0 0

Answer

SELECTED ANSWER
replied on May 29, 2015

Hi Penny,

In your form, did you make the "Miles Driven" field read-only? If so then that could be the cause of your issue. If that is the case, then what you would need to do is to use Javascript to make that field read-only. Here's a generic example that works for me.

Form:

Javascript:

$(document).ready(function () {
  $('.dMiles input').attr('readonly','True');
  $('.bMiles input').on("change", function () {
    $('.dMiles input').val($('.eMiles input').val()-$('.bMiles input').val());
  });
  $('.eMiles input').on("change", function () {
    $('.dMiles input').val($('.eMiles input').val()-$('.bMiles input').val());
  });
});

The beginning mileage field uses the CSS class, bMiles. The ending mileage field uses the CSS class, eMiles. The miles driven field uses the CSS class, dMiles.

Report:

If you're still having an issue, can you let us know what version of Forms you're using and also what Javascript you're using?

Regards

1 0

Replies

replied on May 29, 2015

Perfect!  Thank you yes

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.