
//Simple function for load data in a form.

function fillI18nForm(name_form, i18n_object) {

     Object.entries(i18n_object).forEach(entry => {
        
        const [key, value] = entry;
        
        $('#'+name_form+'_form_'+key+'_form').val(value);
        //document.getElementById(name_form+'_form_'+key+'_form').value=value;
        
    });

}

function fillForm(name_form, value) {
    
    document.getElementById(name_form+'_form').value=value;
    
}

function fillSelect(name_form, value) {
    
    var z=0;
    
    $('#'+name_form+'_form option').each( function () {
    
        //console.log('option '+$(this).val());
        if($(this).val()==value) {
            
            $('#'+name_form+'_form option:eq('+z+')').prop('selected', true);
            
        }
    
        z++;
    
    });
    
}

function resetForm(form) {
    
    //console.log(form);
    /*
    $(':input', form)
      .not(':button, :submit, :reset, :hidden')
      .val('')
      .prop('checked', false)
      .prop('selected', false);*/
      
    $(form).trigger('reset');
    
}
