Hash cookies global not update
Posted: Sat Aug 19, 2023 1:08 pm
i am using this custom code to be able to add 2 icons to each browse module to be able to switch from one browse module to another browse module connected to it by use of global hash cookies, but sometimes this seems not to work in the sense that sometimes the cookies hash variable is not updated and in the second browse module you are shown wrong data. this scares me because it endangers the integrity of the data...
why does this happen?
if i put this code in the second browse module connected to the first one
in the code of the browse module connected from the log I can see that sometimes the code reported is that of the previous client viewed..
why does this happen?
Code: Select all
// No action when clicking a cell
function nuSelectBrowse(e) {
return false;
}
function createButton(target, pk, label, title, openAction) {
let btn = $('<button type="submit" style="padding-top: 2px; height:27px; border: none; vertical-align: center; background-color: #378bd5; transform: translateY(-10%); color:white">'+ label +'</button>');
$(target).html(btn).attr('title', nuTranslate(title));
btn.on('click', function() {
openAction(pk);
});
}
function addButons(column, label, title, openAction) {
$("[data-nu-column='" + column + "']").each(function(index) {
var pk = $(this).attr('data-nu-primary-key');
if (typeof pk !== "undefined") {
createButton(this, pk, label, title, openAction);
}
})
}
function openEditForm(pk) {
nuForm(nuGetProperty('form_id'), pk, '', '', '0');
}
function openBrowseForm(pk) {
nuSetProperty('pk_cliente',pk,true);
nuForm('64da2a46ca706af', '', '', '', '0');
}
// Add an edit and browse button
// Icon list: https://fontawesome.com/v5/search?m=free
addButons(1, '<i class="fa fa-pencil"></i>', 'Modifica', openEditForm);
addButons(0, '<i class="fa fa-search"></i>', 'Elenco', openBrowseForm);
Code: Select all
function nuOnLoad(){
if(nuFormType() == 'browse'){
console.log(nuGetProperty('pk_cliente'));
}
}