exrezzo exrezzo - 4 months ago 23
Javascript Question

Prevent save button to submit form in Django admin

I wrote a control over some input in my admin form, which is executed on save buttons' click (I control a repetition of some inputs, but that's not important).

So, if this check fails, I alert a message, but I also need to avoid django admin to send this wrong request to the server. How can i do it in Javascript? (i'm using jQuery)


If you are using jQuery:

$( "form" ).submit(function( event ) {