Amedeo Petrella
Amedeo Petrella

Reputation: 1

How to prevent response update on Form submission based on cell value in Google Sheet

I created a Google Form that activates the onFormSubmit function every time an answer is entered or modified. I would like to allow the user to change his answer as long as the value in a certain cell changes. When this value is changed, the user can no longer change his response. It can be done?

Here an example:

TEST FORM (with a single field)
Expense:

In the connected Sheet i added the field "Approved" like so:

Timestamp           Expense Approved
4/14/2021 14:33:15  400     YES
4/14/2021 14:33:46  200 

If the user clicks on "edit your response" he can change Expense value.

Test form
Your response has been recorded.
Edit your response
Submit another response

I want that user can't edit his response anymore if Approved field is "YES".

Upvotes: 0

Views: 218

Answers (1)

Michael Krapf
Michael Krapf

Reputation: 75

You could try something like this:

function onEdit(e) {
x = Cell on which to update if filled in
y = "";
if(x !== y)
//your Code
}

Upvotes: 1

Related Questions