Populate in a Google form checkbox question with the new language data

131 views
Skip to first unread message

Jorge Enrique Romero Saray

unread,
Mar 24, 2020, 4:19:48 PM3/24/20
to Google Apps Script Community
Hi, guys, im new in appscript, im having this issue, please your help is needed i appreciate your help.

I want to populate data in a checkbox question with appscript.

This is the part of my code that i present the issue:

Exception: Conversión no válida para el tipo de elemento: MULTIPLE_CHOICE. (línea 38, archivo "Código")Cerrar

  var langQuestion = form.getItemById("1688713959").asCheckboxItem();
// populate the form checkbox question with the new language data
  langQuestion.setChoiceValues(langVals);

Im paste all my code so its more easy for you:

// function to find the form ids

function encontrarFormIds(){
 var form = FormApp.openById("10xnwyDWGeYfmWZAgIERmOfMupja4S3ma-YjUxlC2mhE");
  var formItem = form.getItems();
  
  formItem.forEach(function(item){
    
    Logger.log(item.getTitle() + ' ' + item.getId());
    
  })
}

//* Acerca de ti 1799767473
//* Nombres 1196489671
//* [20-03-19 18:16:08:028 EDT] Correo 1260985361
//* [20-03-19 18:16:08:129 EDT] Tu Experiencia codificando 1398218252
//* [20-03-19 18:16:08:295 EDT] Tienes alguna experiencia previa codificando? 556414867
//* [20-03-19 18:16:08:403 EDT] Que lenguajes de programacion usas? 1688713959
//*

//* Actualizar el formulario dinamicamente desde la Sheet

function actualizarForm(){
 // get the language data from the sheet
  
 var ss = SpreadsheetApp.getActive();
 var setupSheet = ss.getSheetByName("Setup");
 var langVals = setupSheet.getRange(2, 1, setupSheet.getLastRow()-1,1).getValues();
  Logger.log(langVals);                        


//* want to add this languages to the form [[None], [Apps Script], [Python]]
//* Need to get hold of the form element to modify
   var form = FormApp.openById("10xnwyDWGeYfmWZAgIERmOfMupja4S3ma-YjUxlC2mhE");
//* get the languages checkbox item
  
  var langQuestion = form.getItemById("1688713959").asCheckboxItem();
// populate the form checkbox question with the new language data
  langQuestion.setChoiceValues(langVals);


Jorge Enrique Romero Saray

unread,
Mar 24, 2020, 4:29:33 PM3/24/20
to Google Apps Script Community
Hi folks, sorry, i get the problem, the issue was im trying to get a checkbox item but in my form i have a radio button.

Fixed,
Reply all
Reply to author
Forward
0 new messages