How to storage de data of an array and then mark a checbox when the checbox is mark on the google forms?

26 views Asked by At

To give you some context I'm automatazing a google forms to send a pdf file to a certain gmail, everytime is sent, the problem is with the arrays that I have in my code is not filling the checboxes when I mark them in my google forms. Here you can see the code: Here is the array:

var pertenenciasCocinas = {
    cafeteraElectrica: respuestas['Cafetera electrica'] == 'Sí',
    licuadora: respuestas['Licuadora'] == 'Sí',
    botellonAgua: respuestas['Botellón de agua'] == 'Sí',
    cubiertos: respuestas['Cubiertos'] == 'Sí',
    microondas: respuestas['Microondas'] == 'Sí',
    nevera: respuestas['Nevera'] == 'Sí',
    jarronCristal: respuestas['Jarrón de cristal'] == 'Sí',
    tablaPicar: respuestas['Tabla de picar.'] == 'Sí',
    grecaCafetera: respuestas['Greca o cafetera'] == 'Sí',
    setCocina: respuestas['Set de cocina'] == 'Sí'
  };

And here is the code for the checboxes:

  if (pertenenciasCocinas.cafeteraElectrica) {
    body.replaceText("{{CafeteraElectricacotejo}}", "☑");
  } else {
    body.replaceText("{{CafeteraElectricacotejo}}", "☐");
  }
  if (pertenenciasCocinas.licuadora) {
    body.replaceText("{{Licuadoracotejo}}", "☑");
  } else {
    body.replaceText("{{Licuadoracotejo}}", "☐");
  }
  if (pertenenciasCocinas.botellonAgua) {
    body.replaceText("{{BotellonAguaCotejo}}", "☑");
  } else {
    body.replaceText("{{BotellonAguaCotejo}}", "☐");
  }
  if (pertenenciasCocinas.cubiertos) {
    body.replaceText("{{CubiertosCotejo}}", "☑");
  } else {
  body.replaceText("{{CubiertosCotejo}}", "☐");
  }
  if (pertenenciasCocinas.microondas) {
  body.replaceText("{{MicroondasCotejo}}", "☑");
  } else {
  body.replaceText("{{MicroondasCotejo}}", "☐");
  }
  if (pertenenciasCocinas.nevera) {
  body.replaceText("{{NeveraCotejo}}", "☑");
  } else {
  body.replaceText("{{NeveraCotejo}}", "☐");
  }
  if (pertenenciasCocinas.jarronCristal) {
  body.replaceText("{{JarronCristalCotejo}}", "☑");
  } else {
  body.replaceText("{{JarronCristalCotejo}}", "☐");
  }
  if (pertenenciasCocinas.tablaPicar) {
  body.replaceText("{{TablaPicarCotejo}}", "☑");
  } else {
  body.replaceText("{{TablaPicarCotejo}}", "☐");
  }
  if (pertenenciasCocinas.grecaCafetera) {
  body.replaceText("{{GrecaCafeteraCotejo}}", "☑");
  } else {
  body.replaceText("{{GrecaCafeteraCotejo}}", "☐");
  }
  if (pertenenciasCocinas.setCocina) {
  body.replaceText("{{SetCocinaCotejo}}", "☑");
  } else {
  body.replaceText("{{SetCocinaCotejo}}", "☐");
  }

Sorry that the code is in spanish.

I tried to play around with the way im storing things in the array, but I didn't knew how to fix it.

0

There are 0 answers