There is a java-script functionality that allows you to alert the users about a change they made on an input but they didn't hit the save button for example, and at the same time trying to browse to another page. Like in the below example:
When it comes to modals that are generated on the grid edit actions for example, is there a simple way to attach the above functionality to the modal but without implementing the code inside the close click event handlers of the modals?
is there a simple way to attach the above functionality to the modal but without implementing the code inside the close click event handlers of the modals?
Then when will you show the modal popup ? Please explain more about your requirement .
Best Regards,
Ailleen
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.
The modal will be showing on the grid action as usual, but if the user changed any value within the input field without hitting Save button, then they hit the close (the changes are still inside the input) there will be an alert that there changes that you
may lose if you leave.
My question is that I don't want to implement this logic/check within the close event of each modal? Is there a way to handle this in a generic way for every modal on each page?
Firstly, from your description, you could use
F12 developer tools DOM Explorer to find the event, then delete it. Secondly, you could set breakpoint to debug your code, then find the method and remove it.
Thanks for your input, the issue is more related to triggering that a modal has been loaded on the page and then activate the script that you sent on that modal. I'm trying to make this like a global configuration on the modals, rather than setting up each
one events on its own.
Member
7 Points
37 Posts
Enable "unsaved changes "alerts on modals popup
Aug 18, 2016 05:43 PM|Fouad Roumieh|LINK
There is a java-script functionality that allows you to alert the users about a change they made on an input but they didn't hit the save button for example, and at the same time trying to browse to another page. Like in the below example:
http://stackoverflow.com/questions/11844256/alert-for-unsaved-changes-in-form
When it comes to modals that are generated on the grid edit actions for example, is there a simple way to attach the above functionality to the modal but without implementing the code inside the close click event handlers of the modals?
Member
540 Points
130 Posts
Re: Enable "unsaved changes "alerts on modals popup
Aug 19, 2016 05:59 AM|Ailleen|LINK
Hi Fouad Roumieh,
Then when will you show the modal popup ? Please explain more about your requirement .
Best Regards,
Ailleen
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.
Member
7 Points
37 Posts
Re: Enable "unsaved changes "alerts on modals popup
Aug 19, 2016 11:10 AM|Fouad Roumieh|LINK
The modal will be showing on the grid action as usual, but if the user changed any value within the input field without hitting Save button, then they hit the close (the changes are still inside the input) there will be an alert that there changes that you may lose if you leave.
My question is that I don't want to implement this logic/check within the close event of each modal? Is there a way to handle this in a generic way for every modal on each page?
Member
540 Points
130 Posts
Re: Enable "unsaved changes "alerts on modals popup
Aug 22, 2016 11:44 AM|Ailleen|LINK
Hi Fouad Roumieh,
Firstly, from your description, you could use F12 developer tools DOM Explorer to find the event, then delete it. Secondly, you could set breakpoint to debug your code, then find the method and remove it.
The following link is for your reference.
https://msdn.microsoft.com/en-us/library/mt243867.aspx
Best Regards,
Ailleen
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue.
Member
7 Points
37 Posts
Re: Enable "unsaved changes "alerts on modals popup
Aug 22, 2016 07:06 PM|Fouad Roumieh|LINK
You didn't get my question. I want to know how to trigger a modal has been loaded on any page and then attach script to.
All-Star
52091 Points
23222 Posts
Re: Enable "unsaved changes "alerts on modals popup
Aug 22, 2016 07:25 PM|mgebhard|LINK
Just use a JQuery selector that targets only the inputs within the modal.
Member
7 Points
37 Posts
Re: Enable "unsaved changes "alerts on modals popup
Aug 23, 2016 12:37 PM|Fouad Roumieh|LINK
Thanks for your input, the issue is more related to triggering that a modal has been loaded on the page and then activate the script that you sent on that modal. I'm trying to make this like a global configuration on the modals, rather than setting up each one events on its own.