"updatedone" event (v2024)

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

  1. Check your console.log($(args.target)) result in the Console and make sure it is correct. You better check console.log($target.data("field")) and make sure the field is "x_enviaemail".
  2. If it is an unchecked checkbox, the value is undefined. If it is checked, the value is the value attribute of the checkbox (e.g. 1).

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

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