0

I seem to be having an issue pasting code in my responses. This has happened to me in the past, but I think i'm able to reproduce the issue now. When I try to submit the post, it just hangs...

Here is a thread where I tried, but was unable to include the code in my response.

http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/466984/numeric-textbox-with-decimal-point

Attached is the snippet of code that I tried to include in a code block.

User Agent:
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36

Edited by JorgeM

Attachments
Try this conditional statement...


    function isNumberKey(evt) {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (
             (charCode >= 48 && charCode <= 57) || 
             (charCode == 110 || charCode == 190) || 
             (charCode >= 96 && charCode <= 105) 
            )
         {
           return true;
         }
         else
         {
    	   alert("Enter Numeric data Only");      
           return false;
         }
    }




Also, change the event from onkeypress to onkeyup.

`onkeyup="return isNumberKey(event)";`
2
Contributors
7
Replies
24
Views
3 Years
Discussion Span
Last Post by JorgeM
0

Try this conditional statement...

function isNumberKey(evt) {
     var charCode = (evt.which) ? evt.which : event.keyCode
     if (
         (charCode >= 48 && charCode <= 57) || 
         (charCode == 110 || charCode == 190) || 
         (charCode >= 96 && charCode <= 105) 
        )
     {
       return true;
     }
     else
     {
       alert("Enter Numeric data Only");      
       return false;
     }
}

Also, change the event from onkeypress to onkeyup.

onkeyup="return isNumberKey(event)";

0

see attached Pic.. this is what happens when i click "Submit your Reply". I'll try from a different PC/network at some point, and let you know if the problem follows. just wanted you to be aware in the event it affected anyone else..

c4b9d450bb264f7e656b38270deddd53

0

Are there any browser plugins or anything like that on the computer you're trying to use? It worked for me with absolutely no problems. I just copied/pasted what you had in the text file.

0
    function isNumberKey(evt) {
         var charCode = (evt.which) ? evt.which : event.keyCode
         if (
             (charCode >= 48 && charCode <= 57) || 
             (charCode == 110 || charCode == 190) || 
             (charCode >= 96 && charCode <= 105) 
            )
         {
           return true;
         }
         else
         {
           alert("Enter Numeric data Only");      
           return false;
         }
    }
0

Problem seems to be related to the network I was on. tried on different computers in the same network, same issue. No problems outside of the network. Possibly something going on with filtering of the traffic at the perimeter.

0
function isNumberKey(evt) {
         var charCode = (evt.which) ? evt.which : event.keyCode

    }

That's weird...as long as I dont have an if..else block, i can complete the process.

it definately sounds like some filtering rule is causing this issue here..

Ok, take care..

Edited by JorgeM

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.