Hey all I am at a loss and honestly don't know what is happening or why? My knowledge of javascript in general is not that great but I am learning.
I have a object that gets populated by a html document. In that document I have several checkboxes. Some checkboxes are important and they need a VALUE.
*
* Krijg alle verdeler data uit het formulier
* @param form
* @return data object
*/
function getS627Data(form) {
var data = {
IngediendDoor: form.ingediendDoor,
Specialiteit: form.specialiteit,
Aan: form.aan,
Post: form.post,
Station: form.station,
Aanvraag: form.aanvraag,
Rubriek2ARMS: form.rubriek2ARMS,
Rubriek2AAndere: form.rubriek2AAndere,
AanvangDatum: form.aanvangDatum,
AanvangUur: form.aanvangUur,
EindDatum: form.eindDatum,
EindUur: form.eindUur,
MetOverdracht: form.metOverdracht,
Lvhw: form.lvhw,
NodigLvhw: form.nodigLvhw,
NodigLvhwBis: form.nodigLvhwBis,
NodigWl: form.nodigWl
};
return data;
}
So here I populate the object with keys and values
/*
* Al de functionaliteit voor het verdeler formulier
* @param form
* @return succes of fail
*/
function writeVerdelerForm(form) {
try {
var data = this.getVerdelerData(form);
if(data.MetOverdracht == NULL) { data.MetOverdracht = 'FALSE'; }
if(data.Lvhw == NULL) { data.Lvhw = 'FALSE'; }
var sheet = SpreadsheetApp.openById('xxxxxx');
this.writeData(data, sheet);
// finalizeer alle sheet gegevens en creeër dan een pdf
SpreadsheetApp.flush();
this.createPDF(sheet, "Verdeler " + data.Lijn, true);
return this.success();
} catch (error) {
return error.toString();
}
}
And here I tried to do the check to see if the two important keys and values are populated. If not i want to add FALSE to them. Yet they keep on beeing undefined if not checked in the html code.
Am i missing something along the way?
NULL? Is that similar tonull?debugger;right before those statements and use your browsers debugger to inspect the variable. See what their values actually are.if(!data.MetOverdracht) { data.MetOverdracht = false; } if(!data.Lvhw) { data.Lvhw = false; }