import { saveFormData } from 'backend/googleSheet' import { isConfig } from 'backend/config' $w.onReady(async function () { let config = await isConfig(); if (config) { $w('#btnSaveForm').enable(); $w('#promptConfig').hide(); } else { $w('#btnSaveForm').disable(); $w('#promptConfig').show(); } }); export function btnSaveForm_click(event, $w) { if ($w('#firstNameTxt').validity.valid === false) return; if ($w('#lastNameTxt').validity.valid === false) return; saveFormData([$w("#firstNameTxt").value, $w("#lastNameTxt").value]).then(() => { $w('#firstNameTxt').value = ""; $w('#lastNameTxt').value = ""; $w('#savedMessage').show(); $w('#firstNameTxt').resetValidityIndication(); $w('#lastNameTxt').resetValidityIndication(); }) .catch(error => { console.log(error); }); } export function firstNameTxt_keyPress(event) { $w('#savedMessage').hide(); } export function lastNameTxt_keyPress(event) { $w('#savedMessage').hide(); }