exrezzo exrezzo - 1 year ago 148
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)

Answer Source

If you are using jQuery:

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


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download