GAS e.parameter undefined, uploadWidget won't setName

前端 未结 1 1631
后悔当初
后悔当初 2021-01-27 06:36

I\'m working on an answer for another question found here. I have modified a different tutorial script from here, but I\'m having an issue that the e.parameter for the fileUplo

1条回答
  •  一生所求
    2021-01-27 07:20

    File upload in forms needs a doPost function to work, this is not an option ;)

    In such a structure (doGet/doPost) you don't have to define a handler nor a callBackElement, the formPanel is supposed to include all its elements automatically.

    So I tried your modified code and still get one major issue with the numFiles value that is on the table tag : I can't get it...

    If I replace it with a fixed value then everything works nicely, I get the files in the right folder.

    So this answer is not a good answer because it doesn't bring a full solution but at least it reduces its initial scope to that point : how to get this #@!#! numFiles value ?


    EDIT : Found the issue : table doesn't support setName method so its value can't be retrieved in the submitHandler. We should use another widget to hold that value.

    new working Code below : (I used a textBox as a "hidden" widget for test only, please replace by a hiddenWidget when in production)

    function doGet() {
      var app = UiApp.createApplication();
      var panel = app.createVerticalPanel();
      var formPanel = app.createFormPanel();
      var folderLabel = app.createLabel('Folder Name (temp placeholder to remember to use .getFolderById(folderId) to place in specific folder)');
      var folderNameTextBox = app.createTextBox().setId('folderName').setName('folderName');
      var filesLabel = app.createLabel('Add Files to Upload');
      var table = app.createFlexTable().setId('table').setTag('0'); //Here tag will count the number of members
      //Write the header for the table
      var headerArray = ['File(s)'];
      for(var i=0; i

    0 讨论(0)
提交回复
热议问题