Create the following DynaForm:
uploadImageFilesForm.png (77.16 KiB) Viewed 2951 times
This form has the the following fields:
[*] uploadfile with ID and variable named "imageFiles"
[*] submit button with the label "Show Image(s)" and name and ID "showImage"
[*] panel with the ID "imagesPanel"
[*] hidden field with the ID "action"
[*] hidden field with the ID "imagesPanelContent"
[*] submit button with label "Submit"
Then, add the following JavaScript to the DynaForm:
Code: Select allvar content = $("#imagesPanelContent").getValue()
if (content == '') {
$("#imagesPanel").hide();
} else {
var panel = $("#imagesPanel").find("div.panel-body");
panel.html(content);
var wide = panel.width();
var aImgs = panel.find("img").each(function() {
if ($(this).width() > wide) {
$(this).css("width", "100%");
}
});
}
$("#showImage").find("button").click( function() {
$("#action").setValue("show_images");
});
Then create the following trigger:
Code: Select all//set to the ID of the Dynaform holding the multipleFile
$dynaformId = '312783186572278ea6532f8078311726';
if (isset(@@action) and @@action == 'show_images' and is_array(@=imageFiles)) {
@@action = ''; //reset action
@@imagesPanelContent = '';
foreach (@=imageFiles as $aFile) {
@@imagesPanelContent .=
'<p><img src="../cases/cases_ShowDocument?a='.
$aFile['appDocUid'].'&v='.$aFile['version']."\"></p>\n";
}
PMFRedirectToStep(@@APPLICATION, @%INDEX, 'DYNAFORM', $dynaformId);
}
Set this trigger to execute
before the step following the DynaForm or
before assignment if the DynaForm is the last step in the task.
Here is a sample process to test this code:
(32.89 KiB) Downloaded 324 times