Home » Developer & Programmer » Forms » How to restrict entering alphabet into text box
How to restrict entering alphabet into text box [message #232022] Thu, 19 April 2007 02:00 Go to next message
habib.khan
Messages: 20
Registered: March 2007
Location: Islamabad
Junior Member
Hello every one,
i am using oracle 10g,i have a column cnic in employee table with data type is varchar2.i want to programatically restrict entering text and other simbols except - . User can only inter numeric value and - .
how i can solve this proble.Any one who can solve this problem,please tell me in which way i can do this.

Thanks in advance.
habib khan

[Updated on: Thu, 19 April 2007 02:02]

Report message to a moderator

Re: How to restrict entering alphabet into text box [message #232039 is a reply to message #232022] Thu, 19 April 2007 02:44 Go to previous messageGo to next message
rzkhan
Messages: 370
Registered: March 2005
Senior Member
use when-validate-item trigger at item level.

use a for loop upto the length of the string ,to check for invalid value. raise an error in case.

It works any time...

thank you

Riaz
Re: How to restrict entering alphabet into text box [message #232261 is a reply to message #232022] Thu, 19 April 2007 23:38 Go to previous messageGo to next message
djmartin
Messages: 10181
Registered: March 2005
Location: Surges Bay TAS Australia
Senior Member
Account Moderator
Look at http://www.orafaq.com/forum/m/168856/67467/?srch=rtrim+david#msg_168856 and http://www.orafaq.com/forum/m/173919/67467/?srch=rtrim#msg_173919

David
Re: How to restrict entering alphabet into text box [message #239362 is a reply to message #232022] Tue, 22 May 2007 02:32 Go to previous message
mustaf_82
Messages: 20
Registered: May 2007
Location: UAE
Junior Member
Try This...
Paste this code on When-Validate-Item trigger.

declare
chk_str varchar2(2);
len_str number(10);

begin
if :party_tel is not null then
len_str:=length(:party_tel);

for a in 1.. len_str loop
chk_str:=substr(:party_tel,a,1);
if ascii(chk_str) not in (45,48,49,50,51,52,53,54,55,56,57) then
message('Plz Enter The Valid No');
message('Plz Enter The Valid No');
raise form_trigger_failure;
end if;
end loop;
end if;
end;


Previous Topic: How can i validate input number into a Field of type char in oracle form?
Next Topic: Control Item help
Goto Forum:
  


Current Time: Thu Feb 13 02:32:37 CST 2025