You need to sign in to do that
Don't have an account?
Jeff Fontas
inputtext onkeyup closing window
I am experiencing some really strange behavior that I can't seem to figure out. I have created a listener javascript function to capture enter key presses, it looks like this:
<script type="text/javascript">
function submitListener(e){
var keynum = 0;
if (window.event){
keynum = window.event.keyCode;
}
else if (e.which){
keynum = e.which;
}
// Here we check whether the Enter button was pressed
if (keynum == 13){
apexDoQuery();
}
}
</script>
I have designated the function to target this actionFunction:
<apex:actionFunction action="{!saveAndRunQuery}" name="apexDoQuery" reRender="myData"/>
I call the function in this apex:inputText tag:
<label style="margin-right: 50px">Filter by Code Number or Code Title: <apex:inputText value="{!searchString}" onKeyup="submitListener(event)"/></label>
For some reason, whenever I hit enter in the textbox, the popup window I am in simply closes. I was messing around in Chrome developer tools and set an event breakpoint on window.close(), but all it gave me was this line, which is not really descript:
(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {window.close()})
Any help would be greatly appreciated.
<script type="text/javascript">
function submitListener(e){
var keynum = 0;
if (window.event){
keynum = window.event.keyCode;
}
else if (e.which){
keynum = e.which;
}
// Here we check whether the Enter button was pressed
if (keynum == 13){
apexDoQuery();
}
}
</script>
I have designated the function to target this actionFunction:
<apex:actionFunction action="{!saveAndRunQuery}" name="apexDoQuery" reRender="myData"/>
I call the function in this apex:inputText tag:
<label style="margin-right: 50px">Filter by Code Number or Code Title: <apex:inputText value="{!searchString}" onKeyup="submitListener(event)"/></label>
For some reason, whenever I hit enter in the textbox, the popup window I am in simply closes. I was messing around in Chrome developer tools and set an event breakpoint on window.close(), but all it gave me was this line, which is not really descript:
(function() {with (this[2]) {with (this[1]) {with (this[0]) {return function(event) {window.close()})
Any help would be greatly appreciated.
Best Answer chosen by Jeff Fontas
Jeff Fontas
Turns out changing the onKeyup event to onKeypress resolved this for me.