editor dependent field
editor dependent field
netliteIT
Posts: 6Questions: 1Answers: 0
I,i'm refer to editor, i notice that my dependent fields alwasy show this indicator
<div data-dte-e="field-processing" class="DTE_Processing_Indicator" style="display: block;"><span></span></div>
It is correct?
Here my code
editor.dependent( 'born_date', function ( val ) {
editor.field('age').val(calculate_age(val));
} );
// with external function to calculate age from born_date
function calculate_age(data) {
var parts =data.split('-');
console.log(parts[2]+ parts[1] + parts[0]);
var dob = new Date(parts[2], parts[1] - 1, parts[0]);
var diff_ms = Date.now() - dob.getTime();
var age_dt = new Date(diff_ms);
return Math.abs(age_dt.getUTCFullYear() - 1970);
}
Follow the images
Thanks
This discussion has been closed.
Replies
Try adding
callback(true)
at the end - see example here,Colin
Hi Colin perfect, solved!
thanks a lot