Note that there are some explanatory texts on larger screens.

plurals
  1. POdoPost Twice in Google Apps Script?
    primarykey
    data
    text
    <p>I have a web-deployed form written in Google Apps Script with doGet and doPost. In the doPost, the code checks if the user has filled in the form correctly (e.g. not leaving certain things blank). If not, it highlights the things that need to be fixed and adds a warning label. If everything is all right, it writes the form data to a spreadsheet.</p> <p>The problem is that it doesn't seem like doPost can be called again if the user fixes the problems. </p> <p>Any thoughts? Thanks!</p> <p>EDIT: I am using UiService EDIT: Here is a very simplified version of the app:</p> <pre><code>function doGet(e) { var app = UiApp.createApplication(); var mainForm = app.createFormPanel().setId('mainForm'); var formContent = app.createVerticalPanel().setId('formContent'); var userName = app.createTextBox().setId('userName').setName('userName'); var passport = app.createFileUpload().setName('passport'); var submitButton = app.createSubmitButton('submit here'); var submitButtonWarning = app.createLabel('Something is wrong.').setId('submitButtonWarning') .setVisible(false); formContent .add(userName) .add(passport) .add(submitButton) .add(submitButtonWarning); mainForm.add(formContent); app.add(mainForm); return app; } function doPost(e) { var app = UiApp.getActiveApplication(); var userName = e.parameter.userName; var passport = e.parameter.passport; if (userName == 'no') { app.getElementById('submitButtonWarning').setVisible(true); app.add(app.getElementById('formContent')); return app; } else { app.getElementById('submitButtonWarning').setVisible(false); app.add(app.getElementById('formContent')); return app; } return app; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload