Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restrict user input in Forms

Status
Not open for further replies.

ManjulaMadhu

Programmer
Jan 7, 2003
85
SG
Is there an easy way to restrict user from entering anything besides letters and numbers into a varcharfield on the Oracle Form?
 
Hi,
There is an item property Data type - select Alpha instead of Char. This will accepts only alphabetics and space

Regards,
Rajesh
 
Alpha will restrict to lower and uppercase letters only (and space). You will need to put something like the following into a WHEN-VALIDATE-ITEM trigger:

DECLARE
l_test VARCHAR2(255);
BEGIN
l_test := Replace(Translate(Upper:)block.field),'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ','aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),'a',NULL);
--
IF l_test IS NOT NULL
THEN
Message('Invalid character');
Raise FORM_TRIGGER_FAILURE;
END IF;
END;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top