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

How can I add a third button to save the form and then leave the page? #125

Open
tiuma opened this issue Nov 3, 2017 · 2 comments
Open
Labels

Comments

@tiuma
Copy link

tiuma commented Nov 3, 2017

Hi,

Suppose I have a custom modal with a third button "Save and Leave". That is, I have three buttons, "Leave", "Stay" and "Save & Leave".

I trying to made the following:

`
$('form').dirtyForms({

	dialog: {
                    title: 'Wait!',
                    dialogID: 'custom-dialog', 
                    titleID: 'custom-title',
        }, 
	message: 'Your profile details are not saved. Are you sure to leave the page?' 
});	
    $( "#save-profile" ).click(function() {
      $( "#profile-form" ).submit();
    });

`
So, when I click on the "Save" button with id="save-profile", I submit the form via Jquery.

After submit the form, how can I proceed (leaving the page) but to the desired link (just as the default behavior of Leave button)? It is possible?

Thanks for your help!

@NightOwl888
Copy link
Collaborator

I have answered a similar question on StackOverflow with an example.

@tiuma
Copy link
Author

tiuma commented Nov 14, 2017

Thanks for your response @NightOwl888. The example was great for me. Also I use Boostrap modals dialogs instead of JQueryUI dialogs.

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

No branches or pull requests

2 participants