Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Update display field on form

Post Reply
vinaduro
Posts: 1
Joined: Sun Apr 03, 2016 7:32 pm

Update display field on form

Unread post by vinaduro »

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.

Vinaduro
admin
Site Admin
Posts: 2784
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5
Been thanked: 3 times

Re: Update display field on form

Unread post by admin »

vinaduro,

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()


Steven
Post Reply