使用应用脚本在电子表格中使用未定义的值

时间:2014-07-27 19:20:52

标签: google-apps-script

我的代码有问题,我正在编写一个保留时间,位置,设备等的表单,并将这些信息保存在电子表格中,但结果是一行值未定义。 我不知道这是错的,你能帮助我吗? 提前谢谢

附上我的代码

//textbox Style 5
var _tb5 = {
  'width': '230px',
  'border': '1px solid #3366FF',
  'borderLeft': '4px solid #3366FF'
}

var _tb1 = {
  'width': '50px',
  'border': '1px solid #3366FF',
  'borderLeft': '4px solid #3366FF'
}
var _text = {
  'width': '230px'
}

var _even = {
  'width': '190px'
}

var _marc = {
  'width': '190px'
}

var _title={
 'font-weight':'bold' 
}


//Function to apply the style on an element
function applyCSS(element,style){
  for (var key in style){
    element.setStyleAttribute(key, style[key]); 
  }
}

//function myFunction() {  
//}



function doGet(p) {
   var app = UiApp.createApplication().setStyleAttribute("textAlign", "center");
   var form = app.createFormPanel().setStyleAttribute("textAlign", "center");
   var flow = app.createFlowPanel().setStyleAttribute("textAlign", "center");


  flow.add(app.createLabel()
            .setSize(1000, 50));

   flow.add(app.createLabel("Show Requisition Form")
            .setSize(800, 50)
            .setStyleAttribute("fontSize", "20")
            .setStyleAttribute("fontWeight", "Bold")
            .setStyleAttribute("textAlign", "center")
           );


  //var panel = app.createVerticalPanel();
  var grid = app.createGrid(6,4);
  //var formattedDate = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd'T'HH:mm:ss'Z'");

  var label0 = app.createLabel('Step 1 - Information')
  applyCSS(label0,_title);
  var label1 = app.createLabel('Request by: ').setWidth('70');
  applyCSS(label1,_marc);
  var textBox1 = app.createTextBox();
  //apply CSS on text box1
  applyCSS(textBox1,_tb5);
  var label2 = app.createLabel('Date Request: ');
  applyCSS(label2,_marc);
  var currentdate= new Date();
  var textBox2 = app.createDateBox().setFormat(UiApp.DateTimeFormat.DATE_LONG).setValue(currentdate);
  applyCSS(textBox2,_tb5);

  var labelm = app.createLabel('EMail: ');
  applyCSS(labelm,_marc);
  var textBoxm = app.createTextBox();
  applyCSS(textBoxm,_tb5)
  var label3 = app.createLabel('Show name: ');
  applyCSS(label3,_marc);
  var textBox3 = app.createTextBox();
  applyCSS(textBox3,_tb5);
  var label4 = app.createLabel('What: ');
  applyCSS(label4,_marc);
  var textBox4 = app.createListBox().addItem("").addItem("Conferences").addItem("Flag Ceremonies").addItem("other");
  applyCSS(textBox4,_tb5);
  var label5 = app.createLabel('When: ');
  applyCSS(label5,_marc);
  var textBox5 = app.createDateBox().setFormat(UiApp.DateTimeFormat.DATE_LONG);
  applyCSS(textBox5,_tb5);
  var label6 = app.createLabel('Where: ');
  applyCSS(label6,_marc);
  var dataItemsLB = app.createListBox(); // create a basic list box
  dataItems(dataItemsLB);
  applyCSS(dataItemsLB,_tb5);


  var label7 = app.createLabel('Start time: ');
  applyCSS(label7,_marc);
  var textBox7 = app.createListBox();
  datatime(textBox7)
  applyCSS(textBox7,_tb5);
  var label8 = app.createLabel('End time: ');
  applyCSS(label8,_marc);
  var textBox8 = app.createListBox();
  datatime2(textBox8)
  applyCSS(textBox8,_tb5);



  //.setValue(Today)

  grid.setWidget(0, 0, label0)
    .setWidget(2, 0, label1)
    .setWidget(2, 1, textBox1)
    .setWidget(1, 2, label2)
    .setWidget(1, 3, textBox2)
    .setWidget(2, 2, labelm)
    .setWidget(2, 3, textBoxm)
    .setWidget(3, 0, label3)
    .setWidget(3, 1, textBox3)
    .setWidget(4, 0, label4)
    .setWidget(4, 1, textBox4)
    .setWidget(4, 2, label7)
    .setWidget(4, 3, textBox7)
    .setWidget(3, 2, label5)
    .setWidget(3, 3, textBox5)
    .setWidget(5, 0, label6)
    .setWidget(5, 1, dataItemsLB)
    .setWidget(5, 2, label8)
    .setWidget(5, 3, textBox8);   



  //panel.add(grid);

  var grid2 = app.createGrid(1,1);
  grid2.setWidget(0, 0, grid)
  .setBorderWidth(2)
  .setStyleAttribute("textAlign", "center");

  flow.add(grid2);
  form.add(flow);
  app.add(form);  

  var BotonCal = app.createButton('Go step 2');
  flow.add(BotonCal);


  var serverhandler = app.createServerHandler('Paso2');

    serverhandler.addCallbackElement(textBox1)

    .addCallbackElement(textBox2)
    .addCallbackElement(textBox3)
    .addCallbackElement(textBox4)
    .addCallbackElement(textBox5)
    .addCallbackElement(dataItemsLB)
    .addCallbackElement(textBoxm)
    .addCallbackElement(flow)
    .addCallbackElement(textBox7)
    .addCallbackElement(textBox8)


  var clienthandler = app.createClientHandler()
  .forTargets(BotonCal).setEnabled(false);

  var clienthandler2 = app.createClientHandler()
  .forTargets(textBox5).setEnabled(false);

  var clienthandler3 = app.createClientHandler()
  .forTargets(textBox7).setEnabled(false);

  var clienthandler4 = app.createClientHandler()
  .forTargets(textBox8).setEnabled(false);

  BotonCal.addClickHandler(serverhandler);
  BotonCal.addClickHandler(clienthandler);
  BotonCal.addClickHandler(clienthandler2);
  BotonCal.addClickHandler(clienthandler3);
  BotonCal.addClickHandler(clienthandler4);

    return app; 
}


function Paso2(e) {

   var app = UiApp.getActiveApplication();
   var flow2 = app.createFlowPanel();


var parameter = e.parameter;
var Requestby=app.createTextBox().setValue(parameter.textBox1);
var DateRequest=app.createTextBox().setValue(parameter.textBox2);
var Showname=app.createTextBox().setValue(parameter.textBox3);
var What=app.createTextBox().setValue(parameter.textBox4);
var When=app.createTextBox().setValue(parameter.textBox5);
var Where=app.createTextBox().setValue(parameter.dataItemsLB);
var Email=app.createTextBox().setValue(parameter.textBoxm);  
var Starttime=app.createTextBox().setValue(parameter.textBox7);
var Endtime=app.createTextBox().setValue(parameter.textBox8);










    //var panel = app.createVerticalPanel();
  var gridA = app.createGrid(13,6);
  //var formattedDate = Utilities.formatDate(new Date(), "GMT", "yyyy-MM-dd'T'HH:mm:ss'Z'");
  //apply CSS on text box1
  var alabel0 = app.createLabel('Step 2 -')
  applyCSS(alabel0,_title);
  var alabel01 = app.createLabel('Equipment')
  applyCSS(alabel01,_title);

  var alabel1 = app.createLabel('Audio equipment ');
  applyCSS(alabel1,_text);
  var atextBox1 = app.createTextBox().setWidth(1);
  applyCSS(atextBox1,_tb1);
  var alabel2 = app.createLabel('Podium Microphone ');
  applyCSS(alabel2,_text);
  var atextBox2 = app.createTextBox().setWidth(1);
  applyCSS(atextBox2,_tb1);
  var alabel3 = app.createLabel('Cordless microphone ');
  applyCSS(alabel3,_text);
  var atextBox3 = app.createTextBox().setWidth(1);
  applyCSS(atextBox3,_tb1);
  var alabel4 = app.createLabel('OLapel mike or lavalier microphone ');
  applyCSS(alabel4,_text);
  var atextBox4 = app.createTextBox().setWidth(1);
  applyCSS(atextBox4,_tb1);
  var alabel5 = app.createLabel('Ambient mikes ');
  applyCSS(alabel5,_text);
  var atextBox5 = app.createTextBox().setWidth(1);
  applyCSS(atextBox5,_tb1);
  var alabel6 = app.createLabel('Headset microphone ');
  applyCSS(alabel6,_text);
  var atextBox6 = app.createTextBox().setWidth(1);
  applyCSS(atextBox6,_tb1);
  var alabel7 = app.createLabel('Body microphone instruments ');
  applyCSS(alabel7,_text);
  var atextBox7 = app.createTextBox().setWidth(1);
  applyCSS(atextBox7,_tb1);
  var alabel8 = app.createLabel('Lighting fixture for scenery ');
  applyCSS(alabel8,_text);
  var atextBox8 = app.createTextBox().setWidth(1);
  applyCSS(atextBox8,_tb1);
  var alabel9 = app.createLabel('Mobile lab car or COW ');
  applyCSS(alabel9,_text);
  var atextBox9 = app.createTextBox().setWidth(1);
  applyCSS(atextBox9,_tb1);
  var alabel10 = app.createLabel('Stand microphone ');
  applyCSS(alabel10,_text);
  var atextBox10 = app.createTextBox().setWidth(1);
  applyCSS(atextBox10,_tb1);
  var alabel11 = app.createLabel('Proyector ');
  applyCSS(alabel11,_text);
  var atextBox11 = app.createTextBox().setWidth(1);
  applyCSS(atextBox11,_tb1);
  var alabel12 = app.createLabel('Screen ');
  applyCSS(alabel12,_text);
  var atextBox12 = app.createTextBox().setWidth(1);
  applyCSS(atextBox12,_tb1);
  var alabel13 = app.createLabel('Laser pointer ');
  applyCSS(alabel13,_text);
  var atextBox13 = app.createTextBox().setWidth(1);
  applyCSS(atextBox13,_tb1);
  var alabel14 = app.createLabel('CdPlayer ');
  applyCSS(alabel14,_text);
  var atextBox14 = app.createTextBox().setWidth(1);
  applyCSS(atextBox14,_tb1);
  var alabel15 = app.createLabel('DvdPlayer ');
  applyCSS(alabel15,_text);
  var atextBox15 = app.createTextBox().setWidth(1);
  applyCSS(atextBox15,_tb1);
  var alabel16 = app.createLabel('Photographic camera ');
  applyCSS(alabel16,_text);
  var atextBox16 = app.createTextBox().setWidth(1);
  applyCSS(atextBox16,_tb1);
  var alabel17 = app.createLabel('Videocamera ');
  applyCSS(alabel17,_text);
  var atextBox17 = app.createTextBox().setWidth(1);
  applyCSS(atextBox17,_tb1);
  var alabel18 = app.createLabel('Services');
  applyCSS(alabel18,_title);

  var alabel19 = app.createLabel('Internet');
  applyCSS(alabel19,_text);
  var acheck19 = app.createCheckBox()
  //applyCSS(acheck19,_tb1);
  var alabel20 = app.createLabel('MacBook or laptop into scenery');
  applyCSS(alabel20,_text);
  var acheck20 = app.createCheckBox()
  //applyCSS(acheck20,_tb1);
  var alabel21 = app.createLabel('Macbook or laptop into cabin sound');
  applyCSS(alabel21,_text);
  var acheck21 = app.createCheckBox()
  //applyCSS(acheck21,_tb1);
  var alabel22 = app.createLabel('Paging sound system');
  applyCSS(alabel22,_text);
  var acheck22 = app.createCheckBox()
  //applyCSS(acheck22,_tb1);



  var onvalidInput1 = app.createClientHandler()
      .validateNumber(atextBox1)
      .forTargets(atextBox1).setStyleAttribute("color", "Black");

  var onvalidInput2 = app.createClientHandler()
      .validateNumber(atextBox2)
      .forTargets(atextBox2).setStyleAttribute("color", "Black");  

  var onvalidInput3 = app.createClientHandler()
      .validateNumber(atextBox3)
      .forTargets(atextBox3).setStyleAttribute("color", "Black");  

   var onvalidInput4 = app.createClientHandler()
      .validateNumber(atextBox4)
      .forTargets(atextBox4).setStyleAttribute("color", "Black"); 

    var onvalidInput5 = app.createClientHandler()
      .validateNumber(atextBox5)
      .forTargets(atextBox5).setStyleAttribute("color", "Black");

    var onvalidInput6 = app.createClientHandler()
      .validateNumber(atextBox6)
      .forTargets(atextBox6).setStyleAttribute("color", "Black");

    var onvalidInput7 = app.createClientHandler()
      .validateNumber(atextBox7)
      .forTargets(atextBox7).setStyleAttribute("color", "Black");

    var onvalidInput8 = app.createClientHandler()
      .validateNumber(atextBox8)
      .forTargets(atextBox8).setStyleAttribute("color", "Black");

    var onvalidInput9 = app.createClientHandler()
      .validateNumber(atextBox9)
      .forTargets(atextBox9).setStyleAttribute("color", "Black");

    var onvalidInput10 = app.createClientHandler()
      .validateNumber(atextBox10)
      .forTargets(atextBox10).setStyleAttribute("color", "Black");

    var onvalidInput11 = app.createClientHandler()
      .validateNumber(atextBox11)
      .forTargets(atextBox11).setStyleAttribute("color", "Black");

    var onvalidInput12 = app.createClientHandler()
      .validateNumber(atextBox12)
      .forTargets(atextBox12).setStyleAttribute("color", "Black");

    var onvalidInput13 = app.createClientHandler()
      .validateNumber(atextBox13)
      .forTargets(atextBox13).setStyleAttribute("color", "Black");

    var onvalidInput14 = app.createClientHandler()
      .validateNumber(atextBox14)
      .forTargets(atextBox14).setStyleAttribute("color", "Black");

    var onvalidInput15 = app.createClientHandler()
      .validateNumber(atextBox15)
      .forTargets(atextBox15).setStyleAttribute("color", "Black");

    var onvalidInput16 = app.createClientHandler()
      .validateNumber(atextBox16)
      .forTargets(atextBox16).setStyleAttribute("color", "Black");

    var onvalidInput17 = app.createClientHandler()
      .validateNumber(atextBox17)
      .forTargets(atextBox17).setStyleAttribute("color", "Black");

atextBox10.addKeyUpHandler(onvalidInput10);
atextBox11.addKeyUpHandler(onvalidInput11);
atextBox12.addKeyUpHandler(onvalidInput12);
atextBox13.addKeyUpHandler(onvalidInput13);
atextBox14.addKeyUpHandler(onvalidInput14);
atextBox15.addKeyUpHandler(onvalidInput15);
atextBox16.addKeyUpHandler(onvalidInput16);
atextBox17.addKeyUpHandler(onvalidInput17);
atextBox2.addKeyUpHandler(onvalidInput2);
atextBox3.addKeyUpHandler(onvalidInput3);
atextBox4.addKeyUpHandler(onvalidInput4);
atextBox5.addKeyUpHandler(onvalidInput5);
atextBox6.addKeyUpHandler(onvalidInput6);
atextBox7.addKeyUpHandler(onvalidInput7);
atextBox8.addKeyUpHandler(onvalidInput8);
atextBox9.addKeyUpHandler(onvalidInput9);
atextBox1.addKeyUpHandler(onvalidInput1);


 var oninvalidInput1 = app.createClientHandler()
      .validateNotNumber(atextBox1)
      .forTargets(atextBox1).setStyleAttribute("color", "red");

  var oninvalidInput2 = app.createClientHandler()
      .validateNotNumber(atextBox2)
      .forTargets(atextBox2).setStyleAttribute("color", "red");  

  var oninvalidInput3 = app.createClientHandler()
      .validateNotNumber(atextBox3)
      .forTargets(atextBox3).setStyleAttribute("color", "red");  

   var oninvalidInput4 = app.createClientHandler()
      .validateNotNumber(atextBox4)
      .forTargets(atextBox4).setStyleAttribute("color", "red"); 

    var oninvalidInput5 = app.createClientHandler()
      .validateNotNumber(atextBox5)
      .forTargets(atextBox5).setStyleAttribute("color", "red");

    var oninvalidInput6 = app.createClientHandler()
      .validateNotNumber(atextBox6)
      .forTargets(atextBox6).setStyleAttribute("color", "red");

    var oninvalidInput7 = app.createClientHandler()
      .validateNotNumber(atextBox7)
      .forTargets(atextBox7).setStyleAttribute("color", "red");

    var oninvalidInput8 = app.createClientHandler()
      .validateNotNumber(atextBox8)
      .forTargets(atextBox8).setStyleAttribute("color", "red");

    var oninvalidInput9 = app.createClientHandler()
      .validateNotNumber(atextBox9)
      .forTargets(atextBox9).setStyleAttribute("color", "red");

    var oninvalidInput10 = app.createClientHandler()
      .validateNotNumber(atextBox10)
      .forTargets(atextBox10).setStyleAttribute("color", "red");

    var oninvalidInput11 = app.createClientHandler()
      .validateNotNumber(atextBox11)
      .forTargets(atextBox11).setStyleAttribute("color", "red");

    var oninvalidInput12 = app.createClientHandler()
      .validateNotNumber(atextBox12)
      .forTargets(atextBox12).setStyleAttribute("color", "red");

    var oninvalidInput13 = app.createClientHandler()
      .validateNotNumber(atextBox13)
      .forTargets(atextBox13).setStyleAttribute("color", "red");

    var oninvalidInput14 = app.createClientHandler()
      .validateNotNumber(atextBox14)
      .forTargets(atextBox14).setStyleAttribute("color", "red");

    var oninvalidInput15 = app.createClientHandler()
      .validateNotNumber(atextBox15)
      .forTargets(atextBox15).setStyleAttribute("color", "red");

    var oninvalidInput16 = app.createClientHandler()
      .validateNotNumber(atextBox16)
      .forTargets(atextBox16).setStyleAttribute("color", "red");

    var oninvalidInput17 = app.createClientHandler()
      .validateNotNumber(atextBox17)
      .forTargets(atextBox17).setStyleAttribute("color", "red");

atextBox10.addKeyUpHandler(oninvalidInput10);
atextBox11.addKeyUpHandler(oninvalidInput11);
atextBox12.addKeyUpHandler(oninvalidInput12);
atextBox13.addKeyUpHandler(oninvalidInput13);
atextBox14.addKeyUpHandler(oninvalidInput14);
atextBox15.addKeyUpHandler(oninvalidInput15);
atextBox16.addKeyUpHandler(oninvalidInput16);
atextBox17.addKeyUpHandler(oninvalidInput17);
atextBox2.addKeyUpHandler(oninvalidInput2);
atextBox3.addKeyUpHandler(oninvalidInput3);
atextBox4.addKeyUpHandler(oninvalidInput4);
atextBox5.addKeyUpHandler(oninvalidInput5);
atextBox6.addKeyUpHandler(oninvalidInput6);
atextBox7.addKeyUpHandler(oninvalidInput7);
atextBox8.addKeyUpHandler(oninvalidInput8);
atextBox9.addKeyUpHandler(oninvalidInput9);
atextBox1.addKeyUpHandler(oninvalidInput1);  









  gridA.setWidget(0, 0, alabel0)
    .setWidget(0, 1, alabel01)
    .setWidget(2, 0, atextBox1)
    .setWidget(2, 1, alabel1)
    .setWidget(2, 2, atextBox2)
    .setWidget(2, 3, alabel2)
    .setWidget(2, 4, atextBox3)
    .setWidget(2, 5, alabel3)
    .setWidget(3, 0, atextBox4)
    .setWidget(3, 1, alabel4)
    .setWidget(3, 2, atextBox5)
    .setWidget(3, 3, alabel5)
    .setWidget(3, 4, atextBox6)
    .setWidget(3, 5, alabel6)
    .setWidget(4, 0, atextBox7)
    .setWidget(4, 1, alabel7)
    .setWidget(4, 2, atextBox8)
    .setWidget(4, 3, alabel8)
    .setWidget(4, 4, atextBox9)
    .setWidget(4, 5, alabel9)
    .setWidget(5, 0, atextBox10)
    .setWidget(5, 1, alabel10)
    .setWidget(5, 2, atextBox11)
    .setWidget(5, 3, alabel11)
    .setWidget(5, 4, atextBox12)
    .setWidget(5, 5, alabel12)
    .setWidget(6, 0, atextBox13)
    .setWidget(6, 1, alabel13)
    .setWidget(6, 2, atextBox14)
    .setWidget(6, 3, alabel14)
    .setWidget(6, 4, atextBox15)
    .setWidget(6, 5, alabel15)
    .setWidget(7, 0, atextBox16)
    .setWidget(7, 1, alabel16)
    .setWidget(7, 2, atextBox17)
    .setWidget(7, 3, alabel17)
    .setWidget(9, 1, alabel18)

    .setWidget(11, 1, alabel19)
    .setWidget(11, 0, acheck19)
    .setWidget(11, 3, alabel20)
    .setWidget(11, 2, acheck20)
    .setWidget(11, 5, alabel21)
    .setWidget(11, 4, acheck21)
    .setWidget(12, 1, alabel22)
    .setWidget(12, 0, acheck22)







  var grida1 = app.createGrid(1,1);
  grida1.setWidget(0, 0, gridA)
  //.setColumnStyleAttribute(column, attribute, value)
  .setBorderWidth(2);


  var gridb = app.createGrid(6,5);

  var blabel0 = app.createLabel('Information of registered program for that day')

  var blabel1 = app.createLabel('Show ');
  applyCSS(blabel1,_even);
  var blabel2 = app.createLabel('Requestor ');
  applyCSS(blabel2,_even);
  var blabel3 = app.createLabel('Start time ');
  applyCSS(blabel3,_even);
  var blabel4 = app.createLabel('End time ');
  applyCSS(blabel4,_even);


    gridb.setWidget(0, 0, blabel0)
    .setWidget(2, 0, blabel1)
    .setWidget(2, 1, blabel2)
    .setWidget(2, 2, blabel3)
    .setWidget(2, 3, blabel4);

  var grida2 = app.createGrid(1,1);
  grida2.setWidget(0, 0, gridb)
  //.setColumnStyleAttribute(column, attribute, value)
  .setBorderWidth(2);
   var BotonEven = app.createButton('Save Event');

  flow2.add(grida1);
  flow2.add(BotonEven);
  flow2.add(app.createLabel().setSize(1000, 30));
  flow2.add(grida2);
  app.add(flow2);  


  var Formx = app.createTextBox();
  forma(Formx)


  var serverhandlerE = app.createServerHandler('guardando');
    serverhandlerE
    .addCallbackElement(Formx)
    .addCallbackElement(Requestby)
    .addCallbackElement(DateRequest)
    .addCallbackElement(Showname)
    .addCallbackElement(What)
    .addCallbackElement(When)
    .addCallbackElement(Where)
    .addCallbackElement(Email)
    .addCallbackElement(flow2)
    .addCallbackElement(Starttime)
    .addCallbackElement(Endtime)
    .addCallbackElement(atextBox1)
.addCallbackElement(atextBox2)
.addCallbackElement(atextBox3)
.addCallbackElement(atextBox4)
.addCallbackElement(atextBox5)
.addCallbackElement(atextBox6)
.addCallbackElement(atextBox7)
.addCallbackElement(atextBox8)
.addCallbackElement(atextBox9)
.addCallbackElement(atextBox10)
.addCallbackElement(atextBox11)
.addCallbackElement(atextBox12)
.addCallbackElement(atextBox13)
.addCallbackElement(atextBox14)
.addCallbackElement(atextBox15)
.addCallbackElement(atextBox16)
.addCallbackElement(atextBox17)
.addCallbackElement(acheck19)
.addCallbackElement(acheck20)
.addCallbackElement(acheck21)
.addCallbackElement(acheck22)



 BotonEven.addClickHandler(serverhandlerE);

   return app;

}

function forma(variable){
var app = UiApp.getActiveApplication();
var ss = SpreadsheetApp.openById('1KsimTyu3WE2s2VEbqjqNDSsbFSAkS9C1cacz_oJB7ec');
var list = ss.getSheetByName('Catalogo');
var ConForm = Number(list.getRange('O2').getValues())+1;
list.getRange('O2').setValue(ConForm);  

return app; 
}

function dataItems(listbox){
var app = UiApp.getActiveApplication();
var ss = SpreadsheetApp.openById('1KsimTyu3WE2s2VEbqjqNDSsbFSAkS9C1cacz_oJB7ec');
var list = ss.getSheetByName('Catalogo');
var values = list.getRange(2,6,11,6).getValues();
for (var i in values){
listbox.addItem(values[i][0].toString());
}
return app; 
}

function datatime(listbox){
var app = UiApp.getActiveApplication();
var ss = SpreadsheetApp.openById('1KsimTyu3WE2s2VEbqjqNDSsbFSAkS9C1cacz_oJB7ec');
var list = ss.getSheetByName('Catalogo');
var values = list.getRange(2,12,30,12).getValues();
for (var i in values){
listbox.addItem(values[i][0].toString());
}
return app; 
}

function datatime2(listbox2){
var app = UiApp.getActiveApplication();
var ss = SpreadsheetApp.openById('1KsimTyu3WE2s2VEbqjqNDSsbFSAkS9C1cacz_oJB7ec');
var list = ss.getSheetByName('Catalogo');
var values = list.getRange(2,12,30,12).getValues();
for (var i in values){
listbox2.addItem(values[i][0].toString());
}
return app; 
}


function guardando(z){
var app = UiApp.getActiveApplication();
var ss = SpreadsheetApp.openById('1KsimTyu3WE2s2VEbqjqNDSsbFSAkS9C1cacz_oJB7ec');
var Sheet = ss.getSheetByName('Eventos');
var NewRow = Sheet.getLastRow()+1;  

var parameter = z.parameter;
var Formx=parameter.Formx;
var DateRequest=parameter.DateRequest;
var When=parameter.When;
var Requestby=parameter.Requestby;
var Email=parameter.Email; 
var Starttime=parameter.Starttime;
var Endtime=parameter.Endtime;
var Showname=parameter.Showname;
var Where=parameter.Where;
var What=parameter.What;
  var Prueba="test";
  var FechaP="test";
  var InicioP="test";
  var FinP="test";
var Audioequipment =parameter.atextBox1;
var PodiumMicrophone =parameter.atextBox2;
var Cordlessmicrophone =parameter.atextBox3;
var lavaliermicrophone =parameter.atextBox4;
var Ambientmikes =parameter.atextBox5;
var Headsetmicrophone =parameter.atextBox6;
var Bodymicrophone=parameter.atextBox7;
var Lightingfix=parameter.atextBox8;
var COW =parameter.atextBox9;
var Standmicrophone =parameter.atextBox10;
var Proyector =parameter.atextBox11;
var Screen =parameter.atextBox12;
var Laserpointer =parameter.atextBox13;
var CdPlayer =parameter.atextBox14;
var DvdPlayer =parameter.atextBox15;
var Photographiccamera =parameter.atextBox16;
var Videocamera =parameter.atextBox17;
var Internet=parameter.acheck19;
var laptopscenery=parameter.acheck20;
var laptopcabin=parameter.acheck21;
var Pagingsoundsystem=parameter.acheck22;






Sheet.getRange(NewRow, 1).setValue(Formx);
Sheet.getRange(NewRow, 2).setValue(DateRequest);
Sheet.getRange(NewRow, 3).setValue(When);
Sheet.getRange(NewRow, 4).setValue(Requestby);
Sheet.getRange(NewRow, 5).setValue(Email);
Sheet.getRange(NewRow, 6).setValue(Starttime);
Sheet.getRange(NewRow, 7).setValue(Endtime);
Sheet.getRange(NewRow, 8).setValue(Showname);
Sheet.getRange(NewRow, 9).setValue(Where);
Sheet.getRange(NewRow, 10).setValue(What);
Sheet.getRange(NewRow, 11).setValue(Prueba);
Sheet.getRange(NewRow, 12).setValue(FechaP);
Sheet.getRange(NewRow, 13).setValue(InicioP);
Sheet.getRange(NewRow, 14).setValue(FinP);
Sheet.getRange(NewRow, 15).setValue(Audioequipment);
Sheet.getRange(NewRow, 16).setValue(PodiumMicrophone);
Sheet.getRange(NewRow, 17).setValue(Cordlessmicrophone);
Sheet.getRange(NewRow, 18).setValue(lavaliermicrophone);
Sheet.getRange(NewRow, 19).setValue(Ambientmikes);
Sheet.getRange(NewRow, 20).setValue(Headsetmicrophone);
Sheet.getRange(NewRow, 21).setValue(Bodymicrophone);
Sheet.getRange(NewRow, 22).setValue(Lightingfix);
Sheet.getRange(NewRow, 23).setValue(COW);
Sheet.getRange(NewRow, 24).setValue(Standmicrophone);
Sheet.getRange(NewRow, 25).setValue(Proyector);
Sheet.getRange(NewRow, 26).setValue(Screen);
Sheet.getRange(NewRow, 27).setValue(Laserpointer);
Sheet.getRange(NewRow, 28).setValue(CdPlayer);
Sheet.getRange(NewRow, 29).setValue(DvdPlayer);
Sheet.getRange(NewRow, 30).setValue(Photographiccamera);
Sheet.getRange(NewRow, 31).setValue(Videocamera);
Sheet.getRange(NewRow, 32).setValue(Internet);
Sheet.getRange(NewRow, 33).setValue(laptopscenery);
Sheet.getRange(NewRow, 34).setValue(laptopcabin);
Sheet.getRange(NewRow, 35).setValue(Pagingsoundsystem);
}

1 个答案:

答案 0 :(得分:1)

您似乎忘了将NAMES设置为您的小部件。

使用e.parameter.widgetName在处理函数中检索值,此名称使用setName('string')给出,它不是用于创建它的变量的名称。

如果没有此参数,则所有值都将是未定义的。