Closed a2exfr closed 7 years ago
ok I got a quick solution may be you corect it a little
$.each(values_serialized, function(i, item) {
if( item.name.slice(-2) =="[]"){
var test=item.name.slice(0, -2);
data[test]=[];
}
});
$.each(values_serialized, function(i, item) {
if( item.name.slice(-2) =="[]"){
var test=item.name.slice(0, -2);
data[test].push(item.value);
} else {
data[item.name] = item.value;
}
});
I dare to merge... also fix warniing empty needle when no dirprefix
We could also numerically index every [], like ...
var item_name = false;
var new_idx = 0;
$.each(values_serialized, function(i, item){
if( item['name'] != item_name ){
item_name = item['name'];
new_idx = 0;
}else{
new_idx++;
}
item['name'] = item['name'].replace('[]', '[' + new_idx + ']');
data[item['name']] = item['value'];
});
But your way is smarter I guess.
Um, and sorry for breaking your initially working function by using $gp.postC ;-)
not at all, postC is better cause in my function was ugly eval :)
Executing gp_editor.updateSection work no good with multi image control and take only one image(last) to refresh section. I think tthis is no go or I miss something.
Seems to me this change was working good with multi image.
edit: so cached stored content also wrong edit2: may be take postC + getValues function and formdata from my pull? edit3: postC - cant work with formdata)