Hi, I’ve a user submission form which allows 4 images to be uploaded. Whilst I am currently able to take those 4 different fields in the dataset and create an item list for a gallery on page load, it feels more appropriate to create a gallery object in the dataset itself, which can then be manually modified trivially later on, adding extra images etc if the site admin desires.
So whilst I have the code working just fine to change the items on a pro gallery widget, transposing the same code to a back end db update just fails silently, outside of a red “( ! )” icon on that row.
This is working on the dynamic page:
$w( '#gallery' ).items = [{
“type” : “image” ,
“title” : $w( “#dynamicDataset” ).getCurrentItem().fullName,
“src” : $w( “#dynamicDataset” ).getCurrentItem().fileUploadField2
}, {
“type” : “image” ,
“title” : $w( “#dynamicDataset” ).getCurrentItem().fullName,
“src” : $w( “#dynamicDataset” ).getCurrentItem().fileUploadField3
}, {
“type” : “image” ,
“title” : $w( “#dynamicDataset” ).getCurrentItem().fullName,
“src” : $w( “#dynamicDataset” ).getCurrentItem().fileUploadField4
}, {
“type” : “image” ,
“title” : $w( “#dynamicDataset” ).getCurrentItem().fullName,
“src” : $w( “#dynamicDataset” ).getCurrentItem().fileUploadField5
}];
Yet this is not working on the data.js in a beforeInsert event:
item.gallery.items = [{
“type”: “image”,
“title”: item.firstName,
“src”: item.fileUploadField2
}, {
“type”: “image”,
“title”: item.firstName,
“src”: item.fileUploadField3
}, {
“type”: “image”,
“title”: item.firstName,
“src”: item.fileUploadField4
}, {
“type”: “image”,
“title”: item.firstName,
“src”: item.fileUploadField5
}];
in the beforeInsert, I am already happily doing a few simpler things like string concatentation etc, so presume there’s something fundamental that says I can’t manipulate the data at all in this context perhaps?