There is a similar question here:How to disable submit button once it has been clicked?
But no answer works for me.
if I use:
onClick="this.form.submit(); this.disabled=true; this.value='Sending…'; "
code:
{{ comment_form.submit(class_="btn btn-primary",onClick="this.form.submit(); this.disabled=true; this.value='Sending…'; ") }}
There will still be duplicated submits ,the submit has not been disabled
if I use:
onClick="this.disabled=true; this.value='Sending…';"
code:
{{comment_form.submit(class_="btn btn-primary",onClick="this.disabled=true; this.value='Sending…';") }}
</div>
It will stuck at 'Sending...',and no submit happen.