Link to home
Start Free TrialLog in
Avatar of anumoses
anumosesFlag for United States of America

asked on

oracle forms question

I have a code in a free txt field called comments
and the code is

If :open_reason is null then
      msgbox.show('Reason', 'Reason to Re-Open cannot be Null. Please verify re-enter.', 'OK');
      go_item('open_reason');
      raise form_trigger_failure;
Else
     go_item('emp_validation.emp_id');
     hide_window('open_reason');
End if;
------------The user is just tabbing or entering a space and are able to exit. How can I prevent?
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Try this:

If trim(:open_reason) is null then
...
Avatar of anumoses

ASKER

It did not work. I did a return carriage {enter} key and was able to exit
What trigger are you putting this code in?
ASKER CERTIFIED SOLUTION
Avatar of slightwv (䄆 Netminder)
slightwv (䄆 Netminder)

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
What trigger are you putting this code in?

When-button-pressed trigger

For example can someone exit with a single | character?

yes. They are able to exit
I tried this

select dump(open_reason), open_reason from qc_daily_confirmations
where trunc(CREATE_TIME) = trunc(sysdate)

DUMP(OPEN_REASON)|OPEN_REASON
Typ=1 Len=1: 10|

Its a return carriage I used to exit out
I also tried in my code using

replace(replace(:open_reason,chr(10),' '),chr(13),' ');

did not help
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I got a function from oracle forums. Its works for me

CREATE OR REPLACE FUNCTION strip_bad (p_string IN VARCHAR2)
      RETURN VARCHAR2
    IS
       good_string VARCHAR2(62)
          := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' ||
             'abcdefghijklmnopqrstuvwxyz' ||
             '1234567890';
    BEGIN
      RETURN
       TRANSLATE (p_string, 'T' ||
                              TRANSLATE ( p_string, '.' || good_string
                                                 ,  '.'
                                       ) -- find the bad characters
                         ,  'T');  -- remove the bad characters
  END;

--------------------
select strip_bad('0110.-()*"'||chr(10)||'~!@#$%^&*()|') as strip_bad from dual;

STRIP_BAD
0110
thanks