How do I delay before resubmitting a form?

  • 0
    Good afternoon, please tell me how to turn off the accessibility of the form (I'll just hide it and change it to text) within 15 minutes after the last successful submission. I suppose you need to do it through cookies, after sending, create cookies with a lifetime of 15 minutes, after checking for availability, there are cookies - no form, no cookies - there is a form.
    JavaScript Theodore Gould, Jan 6, 2019

  • 2 Answers
  • 0
    You can simply write the date and time through localStorage and compare.
    Anonymous

  • 0
    For simple cases, localStorage is fine, but what is easy to create is easy to break off.

    For more complex cases, you need to look at the requirements.

    For example, if a user is authorized before sending a message, then the most reliable is, for example, in a radish, to put information that a user has recently posted in such and such a thread. The key's lifetime will determine the duration of the prohibition on re-commenting.

    For the case when the user can remain unauthorized - you need to think. What exactly is worth blocking is a direct entry to the form using the link. The need to request several pages from the site, and even in a certain order, will at least slightly complicate the life of a potential spammer.
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!