How to securely lock the "done" button?

Turns out the CSS-controlled “done” button is still possible to open via the dev tool. Is there another way to securely lock it? I need help with this problem.

Remind me again what the challenge is?

Thanks @Darren_Murphy

Previously I used “pointer-event: none” to lock the done button if the time elapsed. But I found the editing process is still happening. It occurred to me that this application is browser-based, finally, I found the source of the problem my button is still not secure. It turns out that by deleting the CSS in the dev tool, everything becomes open.

Can you give me the link to the previous thread about this?

Okay, never mind. I found it. I won’t link to it, because it’s closed now.
Although even having read through it again I’m not still entirely sure which problem needs solving.
In that thread, you were asking about the best way to determine a users UTC offset, there was no mention of using CSS to hide the done button.

Anyway, I’ll assume that you’ve solved the time issue and now you just need a reliable way to prevent a user from submitting a form if a timing deadline has passed. Is that it?

If you’re using a native form screen, then I think this might be a challenge. Because once a user has a form open, there is really no way to close it. You just have to wait until they submit or cancel. You can use some conditional CSS, but as you’ve discovered there are ways around that.

I think what I would do in this case is use a custom form. This will give you much more control. With a custom form there is no built in submit/cancel buttons, so you have complete control over when/how/if they appear. You also have the option with custom actions to either add the submitted data or not add it based on any criteria - eg. time of day.

So assuming I’m understanding the problem correctly, that’s my advice. Use a custom form.

2 Likes

It’s been a long time and I didn’t find the thread. Maybe the screenshot below can explain. If the red underlines are removed then the “done” button from the edit form will reactivate.

Yes, I understand that part. I was just trying to recall what the real problem was that you were trying to solve. Anyway, see the edits to my previous reply. Maybe my understanding is wrong, I really don’t know.

Haha … I did not read your additional posts. Your directions are quite reasonable. Give me some time to try it.
Thank you

@Darren_Murphy I think this is the best way. While I have not found the weakness.

In the custom form, I keep the “done” button plus a number of usc columns. Besides the deadline issue, there are a number of validations to control the suitability of filling out the form, will this mean using a very long condition? Or do you have other suggestions?

With required data fields in a custom form, I usually keep the logic in the data editor as much as possible. So usually I’ll have an if-then-else column that looks something like the following (simple example):

And then I use that single column to control what can happen on the screen.

1 Like

Got it. Thank you very much.

@Darren_Murphy, I know you are an expert on GAS or Java. How do I set a deadline that respects the timezone, I’m also facing the same problem with a web app script I’m building. The deadline time is the value I input from the Glide app into G Sheets.

Maybe you can make corrections to my script as follows:

function setDeadline(){
    const ss = SpreadsheetApp.getActiveSpreadsheet();
    const ws = ss.getSheetByName ("info");
    const deadlineData = ws.getRange(2,6).getValue();
    const deadline = Utilities.formatDate(deadlineData, 'GMT+7', "MM/dd/yyyy HH:mm:ss");  
      return "Deadline: " +deadline;      
}

That’s okay, I’ve found it by adding the letter Z after the time.
Sorry to bother you.

function setDeadline(){
    const ss = SpreadsheetApp.getActiveSpreadsheet();
    const ws = ss.getSheetByName ("info");
    const deadlineData = ws.getRange(2,6).getValue();
    const deadline = Utilities.formatDate(deadlineData, 'GMT+7', "MM/dd/yyyy HH:mm:ssZ");  
      return "Deadline: " +deadline;   

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.