onoboa
February 21, 2025, 11:27pm
1
Hi,
I have a project from 2021 migrate to 2024, when compile the updatedone does not works when load edit page.
I need to evalualet a tyniint value related to an checkbox, but he result is undefined.
this is my code.
$(document).on("updatedone", function(e, args) {
var $target = $(args.target);
console.log($(args.target));
if ($target.data("field") === "x_enviaemail"){
var vIsChecked = $target.value();
alert(vIsChecked);
if (vIsChecked == 1){
$('#r_tipoemail').show();
$('#r_perfil').show();
$('#r_correo').show();
$('#r_ekey').show();
$('#r_puerto').show();
$('#r_ssl').show();
$('#r_tsl').show();
$('#r_autentifica').show();
}else{
$('#r_tipoemail').hide();
$('#r_perfil').hide();
$('#r_correo').hide();
$('#r_ekey').hide();
$('#r_puerto').hide();
$('#r_ssl').hide();
$('#r_tsl').hide();
$('#r_autentifica').hide();
}
}
});
Thanks for your help, if you have any example please.
Best reggards,
Omar
onoboa
February 24, 2025, 9:01pm
3
Thanks for your help, but the “updatedone” not recognize the property
$target.data(“field”), return undefined.
Really this code works fine until v2021, but I was reading for another way
I try with this option
$(document).on("updatedone", function(e, args) {
var $target = $(args.target);
var $source = $(args.source);
console.log("updatedone");
var a=[];
$('input:checkbox').each(function(){
$fieldname = $(this).attr('name');
$fieldvalue = $(this).attr('value');
if ($fieldname == "x_enviaemail") { // Check field name
console.log("Entró en Envía Email");
console.log($fieldvalue);
if ($fieldvalue == 1) {
console.log("Aparece");
$("#x_enviaemail").prop('checked', true);
$('#r_tipoemail').show();
$('#r_perfil').show();
$('#r_correo').show();
$('#r_ekey').show();
$('#r_puerto').show();
$('#r_ssl').show();
$('#r_tsl').show();
$('#r_autentifica').show();
} else {
console.log("Desaparece");
$("#x_enviaemail").prop('checked', false);
$('#r_tipoemail').hide();
$('#r_perfil').hide();
$('#r_correo').hide();
$('#r_ekey').hide();
$('#r_puerto').hide();
$('#r_ssl').hide();
$('#r_tsl').hide();
$('#r_autentifica').hide();
}
}
})
});
And Is working fine, please if you have any annotation about it please indicates me.
Omar
arbei
February 25, 2025, 12:27am
4
You are doing this for all checkboxes in the page, you shouldn’t.
You better check what the arguments are, e.g. console.log(args)
.