5
I’m new around here. I’m starting in c# and came across the following question:
I have a form, where I haven’t given a post
still, and I didn’t want to let the user leave this screen without saving.
What is the best practice for doing this?
5
I’m new around here. I’m starting in c# and came across the following question:
I have a form, where I haven’t given a post
still, and I didn’t want to let the user leave this screen without saving.
What is the best practice for doing this?
3
The best alternative is using jQuery:
$(window).bind('beforeunload', function(){
return 'Are you sure you want to leave?';
});
Put this inside the tags <script>
and </script>
:
Thanks, this will give a direction for development.
Browser other questions tagged c# asp.net-mvc
You are not signed in. Login or sign up in order to post.
Pablo, you wouldn’t want a user to leave the page without submitting the form, but you don’t want to allow it to go to any page? Like if he clicks another link on the page, if he gives a back in the browser. Explain your goal better with the post and if possible post the code you’ve made so far.
– Erick Gallani
I don’t have code yet, because we are because I will only program when questions like this are resolved. I’m just in planning The idea is to block any link, or display a screen stating that the information will not be saved if you don’t click save. What would be the best output, jqueri, javascript....
– Pablo Ramon Borges