| View previous topic :: View next topic |
| Author |
Message |
nmasna
Joined: 04 Apr 2007 Posts: 37 Location: Cerrito 228 - 4 - B - BsAs - Argentina
|
Posted: Wed Feb 10, 2010 1:31 pm Post subject: Prevent backspace going back a page |
|
|
| Please can you explain how I can prevent the user from pressing the backspace key and going back a page but still allow the key to be used to delete text when the focus is in a text box. |
|
| Back to top |
|
 |
nmasna
Joined: 04 Apr 2007 Posts: 37 Location: Cerrito 228 - 4 - B - BsAs - Argentina
|
Posted: Wed Feb 10, 2010 1:40 pm Post subject: |
|
|
On FlexBrowser, Backspace is a key that works differently than others like Control+P (print) or Control+L (open file). So configuring it as one of KeyBoard/IgnoreKey doesn't always work. As a turnaround please manage it via the HTML code as shown in the following example
| Code: | <HTML>
<HEAD>
<TITLE>FlexBrowser example on Backspace</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META NAME="MobileOptimized" content="240">
<script type="text/javascript">
var inform=false;
function FlexKeyHandler()
{
if (inform) return true;
if (window.event && window.event.keyCode == 8)
{
// try to cancel the backspace
window.event.cancelBubble = true;
window.event.returnValue = false;
return false;
}
}
document.onkeydown = FlexKeyHandler;
</script>
</HEAD>
<BODY>
<P>
On your form fields you will to add <br/>
onfocus="inform=true" onblur="inform=false";
<FORM NAME="BackspaceSample" ACTION="SomeScript.py">
<form>
<input type="text" name="txtENTER" VALUE="" onfocus="inform=true" onblur="inform=false">
<input type="submit" NAME="Ok">
</form>
</FORM>
</P>
</BODY>
</HTML>
|
|
|
| Back to top |
|
 |
|