Update display field on form

Update display field on form

Postby vinaduro » Mon Apr 04, 2016 3:28 am

Hi there,

I've been trying to get this done for a couple of hours now, but for the life of me I can't figure out how.

I have 2 fields on a form that the user would complete e.g. Leads, Sales. These are saved to the database, and when the record is requested again, I set up a display field that calculates the difference between the 2 e.g. Leads - Sales = Deficit.
What I would like to do, is be able to create the Deficit field on the form, so that once the user has filled in the Leads and Sales fields, the Deficit field will automatically be filled with the difference between the 2.

Thank you for any assistance.

Posts: 1
Joined: Mon Apr 04, 2016 3:02 am

Re: Update display field on form

Postby admin » Mon Apr 11, 2016 2:10 pm


You could create some javascript to do this..
Code: Select all
function test(){

   var a = $('#fielda').val();
   var b = $('#fieldb').val();

   $('#fieldc').val(a - b);


and put an onchange event on both fielda and fieldb that runs test()

Site Admin
Posts: 3233
Joined: Mon Jun 15, 2009 9:53 am

Return to General