Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pop up form creates markers but also submits form. #40

Open
darkcloud1801 opened this issue Jul 18, 2019 · 1 comment
Open

Pop up form creates markers but also submits form. #40

darkcloud1801 opened this issue Jul 18, 2019 · 1 comment

Comments

@darkcloud1801
Copy link

This isn't necessarily an issue, but a question.

I want to have this plugin operate like the demo inside the Django Admin, but upon pressing Enter it attempts to submit the form.

How can I associate a preventDefault to the keypress?

@bangpradyumna
Copy link

bangpradyumna commented Sep 28, 2022

Sorry for being 3 years late :P
But I've been able to solve this problem by overriding the admin/submit_line.html and creating a fake hidden submit button before the actual save buttons of django admin. This prevents enter key from submitting the form.

Create the following file in root dir of your django project : templates/admin/submit_line.html

Enter the following code there :

{% extends 'admin/submit_line.html' %}
{% load i18n admin_urls %}

{% block submit-row %}
    <button type="submit" disabled style="display: none" aria-hidden="true"></button>

    {{ block.super }}
{% endblock %}

Hope it helps someone else who stumbles across this problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants