Skip to content

Instantly share code, notes, and snippets.

@jasper07
Created August 24, 2014 00:48
Show Gist options
  • Save jasper07/f52809ddf2b93bd42c62 to your computer and use it in GitHub Desktop.
Save jasper07/f52809ddf2b93bd42c62 to your computer and use it in GitHub Desktop.
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<script id="sap-ui-bootstrap"
type="text/javascript"
data-sap-ui-libs="sap.ui.commons"
data-sap-ui-theme="sap_bluecrystal"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js">
</script>
<script>
jQuery(function() {
var oInput = new sap.ui.commons.TextField();
oInput.onAfterRendering = function() {
if (sap.ui.commons.TextField.prototype.onAfterRendering) {
sap.ui.commons.TextField.prototype.onAfterRendering.apply(this, arguments);
}
this.$().keydown(function(event) {
var ctrlKey = event.ctrlKey;
var altKey = event.altKey;
var shiftKey = event.shiftKey;
var key = event.keyCode;
return (
ctrlKey ||
altKey ||
( 47 < key && key < 58 && shiftKey === false) ||
( 95 < key && key < 106 ) ||
( key === 8) || (key === 9) ||
( key > 34 && key < 40) ||
( key === 46)
);
});
}
oInput.placeAt('content');
});
</script>
</head>
<body class="sapUiBody">
<div id="content"></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment