0

I've been looking for a very simple code to rate limit a form on HTML (I use Django as a backend).

I did not find a solution to disable a button once it has been submitted.

Let's see a simple example:

<form method="POST" action="{% url 'example' %}"> {% csrf_token %} <input name="input" id="input-1" placeholder="Test Field"> <button type="submit" id="btn-1">Submit</button> </form> 

How can we use simple Javascript 'onclick' to disable the button once it's clicked?

3
  • You could do that, but that wouldn't prevent someone from opening dev tools and undisabling it, if they were so inclined. Or using PostMan et al to send form posts. Rate limiting is usually done on the server side. Commented Sep 20, 2022 at 20:39
  • 1
    stackoverflow.com/a/3366892/1024832 Commented Sep 20, 2022 at 20:41
  • Those solutions have issues with them (HTML5 validation, submitting the form twice, etc...) Commented Sep 20, 2022 at 20:54

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.