post - Can't access to event posted values -


I'm writing a little Google App Script which allows me to select several names in the developer's list but my doPost (e) In the method, I can not access the array of values ​​posted (this is undefinded), event if I check all the checkboxes ...

  function on open () {var ss = SpreadsheetApp.getActiveSpreadsheet (); // Add new menu var menu entries = []; MenuEntries.push ({name: "edit page", function name: "start"}) ss.addMenu ("My Tools", menu entries); } Start function () {var app = UiApp.createApplication (); App.setTitle ("Edit Page"); Var formapel = app.createFormPanel (); Var mainPanel = app.createVerticalPanel (); Var GridPanel = app.createGrid (1, 2); // Developer var developperPanel = app.createVerticalPanel () var developer = []; Developers Peash ("John", "Peter", "Max", "Johnny"); (Var i = 1; i & lt; developpers.length; ++ i) {var checkbox = app.createCheckBox (developer [i]). SetName ("dev" + i); DevelopperPanel.add (checkbox); } GridPanel.setWidget (0,0, app.createLabel ("Developer:")); GridPanel.setWidget (0,1, developperPanel); // submit button mainPanel.add (gridPanel); MainPanel.add (app.createSubmitButton () setText ("OK").); FormPanel.add (mainPanel); App.add (FormPanel); Var ss = SpreadsheetApp.getActive (); Ss.show (app); } Function doPost (e) {var app = UiApp.getActiveApplication (); App.add (app.createLabel (e.values ​​[0])); // Here is the error return app; }  

In the example, the list is fixed, but in my real script, I make the list thanks to the spreadsheet.

Thank you

Max

Checkbox value right to view The way is e.parameter [name] , as you said on your own comment. Here are some code examples:

  start function () {// ... var developpers = ["John", "Peter", "Max "," Johnny "]; // You have to leave the developer first (var i = 0; i & lt; developpers.length; ++ i) {// the array starts at zero, a var checkbox no = app.createCheckBox (developer [i]). SetName ("Dev" + i); DevelopperPanel.add (checkbox); } // ...} function doPost (e) {var app = UiApp.getActiveApplication (); Var developer = ["John", "Peter", "Max", "Johnny"]; // repeat it or make it global, if it is constant like this var check = []; (For developers in var i) (e. Parameter ['dev' + i] == 'true') checked push (developer [i]); App.add (app.createLabel (selected)); Return app; }  

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -