Home » Developer & Programmer » Forms » how can i restrict enter alphabet in number field at the time of key pressing
how can i restrict enter alphabet in number field at the time of key pressing [message #258412] Sat, 11 August 2007 12:45 Go to next message
aftab248
Messages: 14
Registered: August 2007
Location: Bangladesh
Junior Member
Hello every one,
i am using oracle 10g. I have a text item,data type NUMBER.
I want enter only numeric character on this field.If another
character pressed, no character should not shows on this field
at the time of key pressing.

how i can solve this problem.Any one who can solve this problem,please tell me in which way i can do this.

Thanks in advance.
Aftab
Re: how can i restrict enter alphabet in number field at the time of key pressing [message #258413 is a reply to message #258412] Sat, 11 August 2007 12:50 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As far as I can tell, Forms can not do that by themselves. You might have to write a piece of Java code to do that.
Re: how can i restrict enter alphabet in number field at the time of key pressing [message #258428 is a reply to message #258413] Sat, 11 August 2007 22:33 Go to previous messageGo to next message
aftab248
Messages: 14
Registered: August 2007
Location: Bangladesh
Junior Member
If u have any java code or jar file to do that plese provide me
that and also tell me how can i apply it.

best wishes
Aftab
Re: how can i restrict enter alphabet in number field at the time of key pressing [message #258512 is a reply to message #258428] Sun, 12 August 2007 20:44 Go to previous messageGo to next message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Go to the Oracle Forms web site http://www.oracle.com/technology/products/forms/index.html and look under 'PJC/Bean Library(External)' http://forms.pjc.bean.over-blog.com/ and then 'Bean - Text items (2)' http://forms.pjc.bean.over-blog.com/categorie-465294.html

Go to the second 'Purpose' titled 'This is a Javabean component that allows to intercept each key typed in a text field'

David
Re: how can i restrict enter alphabet in number field at the time of key pressing [message #258519 is a reply to message #258512] Sun, 12 August 2007 23:29 Go to previous messageGo to next message
musman
Messages: 147
Registered: July 2007
Location: Lahore
Senior Member

declare
v_string varchar2(40) :=:employee.first_name;
v_len number;
v_char char(1);
v_num number;
begin
select length(v_string)
into v_len
from dual;
for i in 1..v_len
loop
v_char :=substr(v_string,i,1);
v_num := ASCII(v_char);
if v_num>47 and v_num<58 then
message('Number found');
message('Number found');
raise form_trigger_failure;
end if;
end loop;
end;
---------------------------------------
i use this code on validate_item to block numbers in character field.
change this according to ur requirenment..it will work.
just change ascii for character in v_num and change message field ..
---------------------------------------
if u have any ambiguity do let me know
Re: how can i restrict enter alphabet in number field at the time of key pressing [message #258587 is a reply to message #258519] Mon, 13 August 2007 02:12 Go to previous messageGo to next message
Littlefoot
Messages: 20891
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Right; but this code will detect numerics in the item validation phase (which is AFTER user has typed a number into an item). OP wants to perform check as user types.

Your code:
- user types ABC123 and presses <Enter>
- your trigger says "Sorry, you have numerics in there"

OP's wish:
- user types ABC1
- Form says "Wrong! You can't type numbers in here!" as soon as '1' is pressed on the keyboard.
Re: how can i restrict enter alphabet in number field at the time of key pressing [message #258594 is a reply to message #258587] Mon, 13 August 2007 02:43 Go to previous messageGo to next message
musman
Messages: 147
Registered: July 2007
Location: Lahore
Senior Member

OK..
i got this ..
so i will try to enhance this more ..
if i can will post here..
Re: how can i restrict enter alphabet in number field at the time of key pressing [message #258942 is a reply to message #258594] Mon, 13 August 2007 18:30 Go to previous message
djmartin
Messages: 10180
Registered: March 2005
Location: Canberra ACT Australia
Senior Member
Account Moderator
Hey usman,

Did you read the previous entries in your thread???? Forms works in block mode and will NOT do character by character analysis!!! Use the Java thingy whose address I posted for you.

David
Previous Topic: time problem
Next Topic: reports6i
Goto Forum:
  


Current Time: Sun Dec 04 14:51:33 CST 2016

Total time taken to generate the page: 0.14342 seconds