Discussion in 'Oracle Forms and Reports' started by aadityainpccs, Dec 7, 2012.
i want to make a text item which accepts numeric values only..thank you
Goto item properties and change the datatype to number.
Thank you for replying but i want to write a pl/sql code at trigger through which if i press anything instead of number then there is no text printed in text item.
you can restrict through pl/sql code also but the number will be printed in the text item. after printing your number will be validated.
Sir,actually i have to make a field for contact number (text item) in which i have to enter only numeric values,if i set its data type property to number then by pressing any alpha-numeric key it will be printed in text item.I want it is not printed in text item with a message indicating that we have enter non numeric key.
As far as i got ur thread, u r having a field for contact number and also wanna have validation for this.
Ok !! So, u wanna validate the input value as numeric value, but r u sure u wanna do this? Coz .. u may get inputs like "+919999999999" or "1800-300-2123" etc where u got alpha-num input. So, if u got any standard input pattern for the item then u can write custom logic to validate the input by following way:
1. Make the item varchar2 item.
2. Define a 'WHEN-VALIDATE-ITEM' trigger for the item.
3. Write custom logic in it to validate the input.
4. In case, u encountered invalid value ...
give a message prompt and stop further program flow..
>> fnd_message.debug('Invalid value entered for the field Contact Number.');
>> Raise Form_Trigger_Failure;
Try it .. I guess it was helpful for u ..
In case u have any doubts, lemme know..
pls tell me that custom logic,which can run for each input values to check its datatype and pattern.Like there is a text item T1,and when I put 1(an integer value) then it would be written in text item,If I put #(non integer value except @) would not be inputted in text item.
Ok!! Presuming u'll be able to atleast catch the input value of the text item in a variable, here's how u can do this by any of the following ways...
1. In your "If ..else ..end if" make use of the SQL commands INSTR to verify whether the restricted characters r a part of the value or not.
2. Iterate through the input value one-by-one taking one character at a time and verifying it with the validation logics u got.
3. Convert the input value into an ASCII value and then verify the ASCII value if it contains any unwanted character.