Detail view field calculation update issue
Posted: 2021-06-14 19:45
Hello group, me again,
I have this js code from the udemy course that updates the age field of the employee table.
The code works if I do a save but will not update the 'age' field after selecting a new BirthDate .
I believe it is supposed to update the form on a new selection then the DB on the save.
here is the code in the 'employee-dv.js' file
$j(function(){
$j('#Age').prop('readonly',true);
$j('#BirthDate-dd,#BirthDate-mm,#BirthDate').change(function(){
var dob = get_date('BirthDate');
var today = new Date();
var age = Math.floor((today-dob) / 1000/60/60/24/365.25);
$j('#Age').val(age);
});
$j('#BirthDate').change();
});
Thanks for any direction you can offer,
Bill Walker
I have this js code from the udemy course that updates the age field of the employee table.
The code works if I do a save but will not update the 'age' field after selecting a new BirthDate .
I believe it is supposed to update the form on a new selection then the DB on the save.
here is the code in the 'employee-dv.js' file
$j(function(){
$j('#Age').prop('readonly',true);
$j('#BirthDate-dd,#BirthDate-mm,#BirthDate').change(function(){
var dob = get_date('BirthDate');
var today = new Date();
var age = Math.floor((today-dob) / 1000/60/60/24/365.25);
$j('#Age').val(age);
});
$j('#BirthDate').change();
});
Thanks for any direction you can offer,
Bill Walker