Backspace moves to previous web page NOW URGENT!!

I have a number of combos in grids which I set to ‘read only’. If a user clicks on one of those and then presses the ‘backspace’ key the web page goes to the previous page visited. This only happens in IE8 but not in Firefox. Please HELP!! as this completely takes the user out of the application.

Thanks

Since this post I have done more testing and I have removed all of the ‘readonly(true)’ methods from the combo boxes. Instead I return ‘false’ on all columns which should not be allowed for editing in the ‘onEditCell’ event. Even after doing that if somebody clicks in one of these cells and then presses ‘Backspace’ the browser moves to the previous site that was visited. It looks like any cell that cannot accept the focus shows this behaviour.

THIS IS A SERIOUS PROBLEM AND NEEDS TO BE SORTED PLEASE HELP.!!

You can try to catch global “onkeypressed” event on the window and block it.

Hi Olga
I have the following code:

  <script  type="text/javascript">

	var winMenuOpts = new dhtmlXWindows();
	winMenuOpts.setImagePath("/javascripts/dhtmlx/dhtmlxWindows/codebase/imgs/");
	winMenuOpts.attachEvent("onKeyPressed",checkBackspace);
	winMenuOpts.createWindow("test",20,20,500,200);

	function checkBackspace(key)
	{
		alert("key = "+ key);
		if(key == 8)
		{
			return false;
		}
		return true;
	}
</script>

This creates a test window with the id = ‘test’ and if I press any keys I am NOT getting the alert. So it looks like the event is either not firing or dhtmlxWindow is not catching the ‘onKeyPressed’ event. The documentation for dhtmlxWindow does not mention ‘onKeyPressed’ as an Event that it handles but it is not giving an error either.

Please help as this situation needs to be resolved SOON.

Thanks

Please can somebody tell me how to catch the ‘onkeypressed’ event in windows or look at my code and tell me what I’m doing wrong.

Currently the use of ‘backspace’ takes the user completely out of my application and is causing SERIOUS PROBLEMS.

Thank you for your help.

I NEED HELP!! Olga suggested using the OnKeyPressed event but I can’t get it to work and this has become a SERIOUS problem for me PLEASE PLEASE HELP!!

How you solve the problem?

@baglieriGonzalo

Do you mean the ‘Backspace’ problem or the ‘OnKey’ event not firing? The only way I solved the backspace problem is by ensuring that my users started in a fresh ‘tab’ or ‘web page’. Then even if they press the backspace key there is no where for them to go.

I stopped trying to get the ‘OnKey’ event to work so I don’t know if it is still a problem or not.

You can add code like next to the page.
It will allow backspace in inputs, but will prevent “back page” functionality.

dhtmlxEvent(document.body, "keydown", function(e){ e = e||window.event; var target = e.target||e.srcElement; if (target.tagName.toLowerCase() == "input" || target.tagName.toLowerCase() == "textarea") return true; if(e.keyCode == 8){ e.cancelBubble=true; if (e.preventDefault) e.preventDefault(); return false; } })

Backspace issue is normal IE behavior, which I also hate by the way.
In other browsers you don’t go back to the previous page when you hit backspace.

In a “normal” combobox (select box) you also go back to the previous page when you hit backspace.
A user normally wouldn’t hit backspace in a select box as he knows you cannot edit the value of the select box.
But when you set the dhtmlx combobox to readonly(true), there’s still a cursor in the box.
This misleads the user as he will think you can delete or edit the value with backspace.
The readonly property of the combobox should be changed so you there’s no cursor anymore.

Fortunately there’s a solution for the backspace issue.
See Alexandra’s comment in post viewtopic.php?f=4&t=15562&p=47312&hilit=combo+readonly#p47312

Just add this code snippet to dhtmlxcombo.js and the problem is solved.

I believe that this code snippet should be standard in the dhtmlxcombo.js as a normal user wouldn’t expect to go back to the previous page when he hits backspace.
In version 3.0 it’s not standard in the code.

Anyway, MS should change this IE backspace behavior. It frustrates everybody.