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

Question about adding jQuery Promises to the closing of the dialog #106

Open
jasonrastovski opened this issue May 3, 2016 · 2 comments
Open

Comments

@jasonrastovski
Copy link

Hello!

I am using the DirtyForms plugin in my current project & have had great success so far. My question has to do with the callCloseDialog, doCommit, and doProceed methods (and is likely specific to my use case, but who knows…)

I'll explain my use case -> I'm using the dirtyforms plugin to detect changes to my form, and if the user wants to navigate away from the form, (chooses to Proceed) I want to perform a simple "POST" to delete the current "item" from the database. Because of the asynchronous nature of javascript, the "POST" sometimes works, but sometimes the change in href causes the POST to be cancelled before it completes.

I've modified my copy of the DirtyForms plugin to use jQuery Promises (the "Close" callback is passed as a promise), and that seems to alleviate my problem. Is this something you can see being of value?

Jason

@NightOwl888
Copy link
Collaborator

Hi,

This sounds like an interesting idea. My only concern is whether this feature can be added without breaking existing integrations.

Also, I am curious if this approach is something that would actually work or if you have the same race condition problem. Could you give it a shot?

In either case, I would be interested in a PR. Even if this doesn't end up in the codebase until the next major version, it would be a nice feature to have. But if you can work out a way to do it that is additive (non-breaking) to existing public interfaces, that would be preferable.

@NightOwl888
Copy link
Collaborator

#96 seems to be related (perhaps the lack of this feature was the cause of the issue).

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

No branches or pull requests

2 participants