Hi Kev1n,
nice to read from you!
I tried different ways and I also asked chatgpt who suggested using ajax with this js
Code: Select all
if (nuFormType() == 'edit') {
// Ottieni l'ID utente loggato
let userId = nuCurrentProperties().user_id;
// Popola il campo pre_id_utente
$('#pre_id_utente').val(userId).change();
// Costruisci i dati per la query
let requestData = {
nuSQL: "SELECT sus_first_name FROM zzzzsys_user WHERE zzzzsys_user_id = '" + userId + "'"
};
// Chiamata AJAX per ottenere il sus_first_name
$.ajax({
type: "POST",
url: "nuajaxPHP.php",
data: requestData,
success: function(response) {
if (response && response[0] && response[0].sus_first_name) {
$('#pre_nome_utente').val(response[0].sus_first_name).change();
} else {
console.log("Nessun nome trovato per l'utente con ID:", userId);
}
},
error: function(xhr, status, error) {
console.error("Errore nella chiamata AJAX:", error);
}
});
}
but that doesn't work in fact it doesn't even populate the user_id field because it doesnt find the url and i didnt find any ajax style .php file in the installation.
I tried using a query changing the field type to select but it gives undefined.
Maybe php could be the way but it is not in my capabilities and then I believe that it is necessary that the value of the user_id must already be written in the db field which is not true when filling out the form where this data must be exposed