Page MenuHomePhabricator

PF_simpleupload.js;html input id patterns dont match causing image file not be saved to form field in MI templates
Open, Needs TriagePublic

Description

a click on upload does not show preview image and does not save file to the respective form field, hence it is not displayed after saving the form (see screenshots below). the file is actually uploaded and a page File:imageexample.png exists

form definition

{{{for template|gallery|multiple|add button text=add picture|embed in field=project[gallery]}}}
;picture:{{{field|gallery picture||input type=text|uploadable}}}
;description:{{{field|gallery description|input type=textarea|cols=80|rows=1}}}
{{{end template}}}

below is a workaround that works fine for me, however it's just for demo purposes. i dont know how you actually handle the ids. anyway, var input = _this.parent().find('#' + _this.data('id')); is undefined

diff --git a/libs/PF_simpleupload.js b/libs/PF_simpleupload.js
index 79b238bd..6cb217c8 100644
--- a/libs/PF_simpleupload.js
+++ b/libs/PF_simpleupload.js
@@ -35,7 +35,7 @@
 
                this.find( "input[type='file'].simpleupload" ).change( function(event) {
                        var _this = $(this);
-                       var input = _this.parent().find('#' + _this.data('id'));
+                       var input = _this.parent().find('.createboxInput');
                        var fileToUpload = event.target.files[0]; // get (first) File
                        var fileName = event.target.files[0].name;
_this.data('id') //-> #input_100
_this.parent().find('.createboxInput') //-> #input_1_100


Event Timeline

Schtom created this task.Dec 6 2019, 6:48 PM
Restricted Application added subscribers: Liuxinyu970226, Aklapper. · View Herald TranscriptDec 6 2019, 6:48 PM
Schtom updated the task description. (Show Details)Dec 6 2019, 6:48 PM