Disable backspace

1,242 views
Skip to first unread message

Andrey

unread,
Dec 12, 2009, 8:35:15 AM12/12/09
to Google Web Toolkit
Hello!

My application is desktop-like, so it does not need any history
support.
The problem is that when I edit a form and accidentally lose focus and
then press Backspace key to delete a character browser performs
history.back() and the whole application is unloaded losing all the
data.

How can I disable this?

Thanks!

Ian Bambury

unread,
Dec 12, 2009, 10:15:10 AM12/12/09
to google-we...@googlegroups.com
You could try Window.addWindowClosingHandler(handler) and put out a 'Do you really want to leave this page?' message, or you can have a look at 

addEventPreview

Ian

http://examples.roughian.com

===============================================================
If Global Warming is being discussed, climatologists have a job.
If Global Warming is proved, climatologists have a job.
If Global Warming is disproved, climatologists are unemployed.
If Global Warming is disproved, will my government pay me back all my 'Green Taxes'?
===============================================================


2009/12/12 Andrey <min...@gmail.com>

--

You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.



Joe Cole

unread,
Dec 15, 2009, 12:32:52 AM12/15/09
to Google Web Toolkit
Hi Andrey,

Did you ever resolve this? We have had reports of people losing data
in this way but have never been able to replicate it.

Andrey

unread,
Dec 18, 2009, 2:59:29 AM12/18/09
to Google Web Toolkit
Hello!

Yes, I just added:

Window.addWindowClosingHandler(new ClosingHandler() {
@Override
public void onWindowClosing(ClosingEvent event) {
event.setMessage("My program");
}
});

as Ian Bambury advised.
That solves the problem and it seems to be necessary for most of the
GWT applications as it is easy to:
1. press backspace when focus is lost from the input field;
2. press back button on the mouse if you have one.

Andrey

unread,
Dec 18, 2009, 3:01:57 AM12/18/09
to Google Web Toolkit
P.S.
To replicate this just open any page, say Google, in Firefox and than
go directly to your program. Your program will become the second in
the browser's history. Then just press "Back" browser button.
Reply all
Reply to author
Forward
0 new messages