473,383 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Stopping navigation away from the page

Hi,

In our ASP .NET application we present a form wherein the user has to
input a number of fields. If in the middle of filling the form, the
user accidentally navigates away from the page, either by clicking a
link on the page or hitting an entry in the Favorites or in any way,
we want to present an alert with only the OK button, which when
clicked will keep the user on the same page and avoid the navigation
out of the page.

If we do it in the onbeforeunload event, we get a standard popup with
OK and CANCEL. When Cancel is clicked, the user navigates away. We
want to avoid this.

Can you please suggest a way? Is there a way to capture the navigation
event and suppress it?

Thanks,
Yash
Jan 31 '08 #1
3 1613
On Jan 31, 5:22 am, Yash <yas...@gmail.comwrote:
Hi,

In our ASP .NET application we present a form wherein the user has to
input a number of fields. If in the middle of filling the form, the
user accidentally navigates away from the page, either by clicking a
link on the page or hitting an entry in the Favorites or in any way,
we want to present an alert with only the OK button, which when
clicked will keep the user on the same page and avoid the navigation
out of the page.

If we do it in the onbeforeunload event, we get a standard popup with
OK and CANCEL. When Cancel is clicked, the user navigates away. We
want to avoid this.

Can you please suggest a way? Is there a way to capture the navigation
event and suppress it?

Thanks,
Yash
1) What is the point in presenting only one option "OK"? Are you
working for early Microsoft (an error occurred - click "OK" to
continue)?
2) If the user does not have a choice then there is NO point in
presenting the box, but you can still use std alert()
3) If you put this script in onUnload event, your user will NEVER be
able to leave the page, or are you going to put some code in Submit
button onClick event to disable the onUnload code?
Jan 31 '08 #2
Yash wrote:
If we do it in the onbeforeunload event, we get a standard popup with
OK and CANCEL. When Cancel is clicked, the user navigates away. We
want to avoid this.
That sounds like a bad idea. Why would you want to not allow a user to
leave ? I agree catching them and asking if they're sure they want to
abandon what they were doing is a good idea, but preventing them from
doing it doesn't sound sensible.
Jan 31 '08 #3
On Jan 31, 5:26*pm, Stevo <ple...@spam-me.comwrote:
Yash wrote:
If we do it in the onbeforeunload event, we get a standard popup with
OK and CANCEL. When Cancel is clicked, the user navigates away. We
want to avoid this.

That sounds like a bad idea. Why would you want to not allow a user to
leave ? I agree catching them and asking if they're sure they want to
abandon what they were doing is a good idea, but preventing them from
doing it doesn't sound sensible.
I want to present only an OK because the user should be made aware of
why he is not being allowed to leave. When he cliks OK, he will be
back on the page.

There will be special flag set onclick of the Submit button to exempt
it from the above check. So only on Submitting, the user will be able
to leave the page.

This is a client requirement and we have no control over it.
Jan 31 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Monty | last post by:
I've been searching for guidance on which of the approaches used for skipping repetive links (e.g., link as normal text, link as alt text on invisible image, link with same forground and background...
4
by: Dave Patton | last post by:
Using my About page as an example: http://members.shaw.ca/davepatton/about.html What is the best/proper way to markup a page such as this that has "the main body" and "a navigation menu"? It...
8
by: Yeah | last post by:
I wish to use a drop box where each Option will not take the user to a web page - but a certain location on the same page the drop box exists. For example, Option 1 would take the user to "Chapter...
0
by: Veli-Pekka Tätilä | last post by:
Hi, My first post here. I've found some serious accessibility flaws in the Python 2.4 docs and wish they could be rectified over time. I'm very new to Python and initially contacted docs at python...
0
by: Robert Weatherford | last post by:
My company is looking for several beta testers for a new VS .NET add-in product. It adds FrontPage-compatible features to VS like shared borders (layout), controls (navigation, substitution,...
7
by: Kewlpack | last post by:
Okay - this is stumping me. I've used .Net since 1.0 release and never had this trouble before... In one of my new projects, if I enable the SmartNavigation="True" in the Page...
1
by: Marc Robitaille | last post by:
hello, I have made Web site for a few years but I had never been concerned with navigation between the pages. All the pages are dynamic but do not have direct relations between them. There, I...
28
by: laredotornado | last post by:
Hi, Surprisingly, I can't get the drop down menus to work on PC IE 6. If you roll over "PRODUCTS", normally a drop down menu appears (on Safari and Firefox), but on PC IE, nada. ...
2
by: slaterino | last post by:
Hello, I'm hoping someone can help me with a couple of queries. I am in the process of designing a site which I have uploaded to: http://www.cca-ltd.co.uk/New/index.html, but I currently have 2...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.