Text Field only accepts numbers

Oracle Application Express - web application development tool (antigamente conhecido como Oracle HTML-DB)
Post Reply
sakai
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Fri, 10 Feb 2017 1:39 pm

Good afternoon galera,
I'm new to the forum and in the Apex world. Would anyone tell me how do I make a text Field found in a form to accept only numbers like input?
Thanks for the help
User avatar
Ivan
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 9
Joined: Tue, 08 Dec 2015 3:03 pm

Speak Sakai!

I believe that if in the table the field is set to "Number" it will only accept number and accuse the error message of type: Invalid Numeric Value "Text" for Column "Name_Coluna"

Take a look there in the table, enter the "SQL Workshop" tab -> Type "If the column in question is as" Number "or another type" varchar, varchar2 and etc. "

Hugs,

Ivan.
sakai
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Fri, 10 Feb 2017 1:39 pm

Speak Ivan, thanks for the answer.
So the type of data is already like Number and so it only accuses the error after the submit. What happens is that I want to occur a "blocking" of the letter keys when I write in the field, that is, I want only the numeric keys to work.
I hope you understood :)
User avatar
Ivan
Rank: Estagiário Sênior
Rank: Estagiário Sênior
Posts: 9
Joined: Tue, 08 Dec 2015 3:03 pm

I understood now Sakai !!

boy, tell you that I found it very interesting and I'vê researched a lot since yesterday a solution to do this.

From what I read and I only found now, you have to create a job in JavaScript (follow below)

Select all

 
 
function isNumber(event) { 
  if (event) { 
  var charCode = (event.which) ? event.which : event.keyCode; 
  if (charCode != 190 && charCode > 31 &&  
  (charCode < 48 || charCode > 57) &&  
  (charCode < 96 || charCode > 105) &&  
  (charCode < 37 || charCode > 40) &&  
  charCode != 110 && charCode != 8 && charCode != 46 ) 
  return false; 
  } 
  return true; 
} 
and then you have to Declare (below the statement) the variable in the item field / column.

Select all

 
onkeydown="return isNumber(event);" 

Any procedure varies from version of Apex the most important that is the function is already ready, which version are you using?
sakai
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 6
Joined: Fri, 10 Feb 2017 1:39 pm

Speak Ivan,
I'm using version 5.1. I also walked around and found JS similar to this, but I could not implement it. I'll see if I can.
Thanks for the answer.
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 24 guests