Key Down Trigger

Plz assist me.
I have a form with a textitem Name and I do not want the user to enter any key apart from [A-Z] i.e ascii value (65 to 90). I want to create a trigger on key-down which returns simple message "plz enter characters only" if user enters any key apart from [A-Z].
Plz answer Thank you.

Create or Replace function funasc (RC Varchar2) Return Boolean
is
vali Number := 0;
kv Number := 0;
vk Number := 0;
as Number := 0;
ab Number := 0;
len Number := 0;
Begin
len := length(RC);
For I in 1..len Loop
If I <> 4 then
vali := ascii(substr(RC, I, 1);
If Vali Between 65 and 90 then
kv := kv + 1;
Else
ab := ab + 1;
End if;
Elsif I = 4 then
vali := ascii(substr(RC, I, 1);
If vali = 45 then
vk := 1;
Else
ab := 1;
End if;
End If;
End Loop;
as := KV + vk;
If as <> len then
Return True;
Elsif as = len then
Return False;
End if;
End;
Trigger : When-Validate-Item
Text_Item : Route_Code
Declare
RC Fare.Route_Code%Type;
Alt Number;
Begin
If funasc(:fare.route_code) then
message ('Route Code : ' || :fare.route_code || ' is invalid.!');
Set_Alert_Property ('ALERTRC', title, 'ROUTE CODE VIOLATION');
Set_Alert_Property ('ALERTRC', alert_message_text, 'Route Code : ' || :fare.route_code || ' is invalid. Plz enter Route Code in [ABC-XYZ] format.!');
Alt := Show_Alert ('ALERTRC');
Raise Form_Trigger_failure;
Else
Select route_code into :fare.route_code from Fare where route_code = :fare.route_code;
message ('Route Code : ' || :fare.route_code || ' already exists.!');
Set_Alert_Property ('ALERTRC', title, 'ROUTE CODE VIOLATION');
     Set_Alert_Property ('ALERTRC', alert_message_text, 'Route Code : ' || :fare.route_code || ' already exists.!');
Alt := Show_Alert ('ALERTRC');
Raise Form_Trigger_failure;
Else
Null;
End if;
End if;
Exception
When No_Data_found Then
     Null;
End;
Wht this coding does is if route_code is not ABC-XYZ format then it through an alert, also if user enters number instead of char then it popup an alert.
Now can this coding be made even smaller.

Similar Messages

  • KEY-DOWN trigger doesnt work on list item

    I am trying to avoid the list item to be pulled down using key-down trigger in developer 6i but key-down trigger has no effect. Is it possible to stop list item to pull down when user press down arrow key. I want the list to pull down only through mouse. Please help.

    Hi!
    May set the Keyboard Navigable and the Mouse Navigate Property to No for your list item,
    so no keyboard change is possible.
    Regards

  • Key-Others Trigger (Please help!!!)

    Hi everybody,
    We are trying to restrict the end user from pressing some
    'dangerous' keys, i.e clear block, execute query, even the DOWN
    key causes us problems in some (1 record) blocks.
    I know there is a way to do it using Oracle terminal but it
    seems that we need greater degree of flexibility.
    I certainly don't want to go to every <KEY> trigger on every
    form (block) and put null; statements there. I know from Oracle
    Docs that I'm supposed to use the key-others trigger..
    So here are my questions:
    1.Is there any way to find out which key has been pressed?
    2.Can someone post a sample code of a KEY-OTHERS triggers?
    3.Is there another way to achieve what we need?
    Thanks is advance for any help.
    Mike
    null

    You have two options.
    1) Turn off all keys not wanted. This is what you said
    you did not want to do.
    2) Tun on all keys you want to use by creating a trigger for
    each key. i.e.
    trigger KEY-NXTREC trigger KEY-UP
    NEXT_RECORD; UP;
    Then turn off all keys not explicitly turned on.
    trigger KEY-OTHERS
    NULL;
    ET (guest) wrote:
    : Hope that it may be helpful.
    : Answer :
    : 1. In command line, add debug option so that you may know what
    : trigger is executing.
    : e.g. runform module= userid= debug=yes
    : 2. Sample code for Key-others trigger
    : null;
    : Rgds,
    : ET
    : Mike Braude (guest) wrote:
    : : Hi everybody,
    : : We are trying to restrict the end user from pressing some
    : : 'dangerous' keys, i.e clear block, execute query, even the
    : DOWN
    : : key causes us problems in some (1 record) blocks.
    : : I know there is a way to do it using Oracle terminal but it
    : : seems that we need greater degree of flexibility.
    : : I certainly don't want to go to every <KEY> trigger on every
    : : form (block) and put null; statements there. I know from
    : Oracle
    : : Docs that I'm supposed to use the key-others trigger..
    : : So here are my questions:
    : : 1.Is there any way to find out which key has been pressed?
    : : 2.Can someone post a sample code of a KEY-OTHERS triggers?
    : : 3.Is there another way to achieve what we need?
    : : Thanks is advance for any help.
    : : Mike
    null

  • Key-down and post-query

    hi,
    i am debugging other people's work. on this form there are database item and non db items. and in post query trigger it populates non db items. the problem is when user key down, it goes to next record and fires post query trigger. but on key up trigger, it doesnt. does key down or key up automatically fires post-query trigger?

    A list box is a very different object from a normal non-database item in the record. Oracle Forms does not expect you to need to change the contents of the poplist when you change records -- the values normally remain the same no matter which record is current.
    So... if you really want a dynamic poplist, then you need to do this:
    1. Use the post-query trigger to look up the name you need, and place it in a hidden Text Item.
    2. In the when-new-form-instance trigger, create a record group at runtime: use create_group_from_query, and just do a select from dual, to establish a two-column record group with the list label colum large enough to hold the name to be displayed.
    3. In a when-new-record-instance trigger in your block, clear the contents of the record group, and then add one row, and then set the value of the label column to the value of the hidden name field.
    4. Then use Populate_List to put the contents of the record group into your poplist.

  • How to separate "Key down" event from panel and numerical control

    Hi, All
    I have a vi proecess key down events for panel and  a numerical control in this panel. the application will do: 
    1. when panel is focused, user can use "up" and "down" key to driver some hardware.
    2. when the numerical control has the focus, "up" and "down" key will change it's value as usual.
    somehow the second one did not work, because the panel "key down" event was trigger as well when I use "up' "down" key inise the numerical control. 
    then I used "Key down?" of numerical control to block the "up/down" key. But the first time when I run the Vi, the panel still got triggered one time. 
    any suggestions on this? test code attached  in this post too. 
    thanks
    CQ
    Solved!
    Go to Solution.
    Attachments:
    KeyDown_Up_valuechange.vi ‏16 KB

    This works for me in 2014.  In short, you just need to check to see if your numeric has the focus.  If it doesn't, then you process the key value.  No need for any other event here except for the stop button.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    KeyDown_Up_valuechange_BD.png ‏32 KB

  • When is Key down event case triggered

    Hi all,
    In event structure there is an event <this VI> key Down? 
    When will this event be triggered... i.e will this event be triggered only in case of a keyboard entry... ?
    Or in case i use a barcode reader, if data gets populated in a control on the Front panel through the barcode reader will this trigger this event...?
    Thanks

    The Key Down event will only be fired when a key is pressed on the keyboard.  If you want to fire an event off of a Front panel control, you can either use a User Event or a property node called Value (Signaling).  This property node will cause a Value Change event to trigger when the value of the Front panel control changes.
    Cheers

  • I can't order more than one picture at a time in iphoto.  I am holding the command key down and highlighting two but only the last one is showing up

    Hi,
    I need help placing an iphoto order online for prints.  I have a few pictures I want in a few sizes and it seems to only allow me to select one at a time.  I have held the command key down but it defaults to the last picture i selected.  I appreciate your help.

    What system and iPhoto versions are you using?  As a quick test try this:  launch iPhoto with the Option key held down and create a new, test library.  Import some photos and check to see if the same problem persists.  See if you can get all of the selected photos in the order window as it should be.
    If you can't then try this:  make a temporary, backup copy (if you don't already have a backup copy) of the library and try the following:
    1 - delete the iPhoto preference file, com.apple.iPhoto.plist, that resides in your
         User/Home()/Library/ Preferences folder.
    2 - delete iPhoto's cache file, Cache.db, that is located in your
         User/Home()/Library/Caches/com.apple.iPhoto folder. 
    Click to view full size
    3 - launch iPhoto and try again.
    NOTE: If you're moved your library from its default location in your Home/Pictures folder you will have to point iPhoto to its new location when you next open iPhoto by holding down the Option key when launching iPhoto.  You'll also have to reset the iPhoto's various preferences.
    OT

  • With Mavericks I have to hold command key down and double click to get a sub folder to open in a new window.  Can I go back to just double clicking ?

    With Mavericks I have to hold command key down and double click to get a sub folder to open in a new window.  Can I go back to just double clicking ?

    Of course. To do it, open a Finder window, go to Finder menu (on the menu bar) > Preferences > General, and untick "Open folders in tabs instead of new windows".

  • I just created a new iPhoto library with holding the option key down and then opening iPhoto with version 7.1.5.  I changed the name of the first library to iPhoto library 1 and now I all my photos are gone.  My operating system is Mavericks.

    I just created a new iPhoto library with holding the option key down and then opening iPhoto with version 7.1.5.  I changed the name of the first library to iPhoto library 1 and now I all my photos are gone.  My operating system is Mavericks.

    launch iPhoto wile holding down the option key and select the original library - when you create a new library of course it is empty
    And you seriously need to backup your iPhoto library and purchase and install iPhoto '11 version 9.5.x from the App store and download and run the iPhoto library upgraded \then run the new iPhoto - 7.1.5 is not fully compatible with Mavericks
    LN
    PS you also need to update your profile - it states that you have OS X 10.6.8

  • Use of KEY-OTHERS trigger

    Hi,
    I have a form that has numerous triggers defined at the form level. The form has a block that appears in a dialog window. The block should only have a small subset of triggers that are defined at the form level. I went ahead and created the key triggers necessary at the block level; I also defined a key-others trigger defined as null on the block to disable all other key triggers defined at the form level???. However it's not working, key triggers at the form level are still firing. Is the key-others trigger suppose to suppress triggers at a lower level or do I have to specifically deactivate all the key triggers at the block level?
    Thanks for you help in advance

    Key-Others at the block level will only override a form-level Key-Others. It will not override any other form-level triggers.
    You must either override all the form-level triggers at the block level, or add code to the beginning of each form-level trigger such as:
    If :System.trigger_block = 'MY_SPECIAL_BLOCK' then
      Return;  -- exit if in the special block
    End if;

  • All I have on my I pod touch is a white screen with multicolored lines going across screen.  What do I need to do.  I can't use I tunes because it says I have to have passcode and can't get screen to come up.  I have already tried holding both keys down.

    All I have on my I pod touch is a white screen with multicolored lines going across screen.  What do I need to do.  I can't use I tunes because it says I have to have passcode and can't get screen to come up.  I have already tried holding both keys down.

    - See if placing the iPod in Recovery mode will allow a restore.. It bypasses the passcode (and erases the iPod)
    - Next try DFU mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings

  • How to make 'Key-Enter' trigger (when clicked on enter key)work like 'F8' key?

    Hi . I have another question to be asked.
    Oracle Forms 6i.
    I have a form in which DEFAULT&SMARTBAR is the menu and there are no push buttons.
    In the form, there is a 'field' named as 'ID No'. After entering 'ID No' in the field and click on 'Execute Query' button from the 'DEFAULT&SMARTBAR' menu, all the details of that respective 'ID No' gets displayed in all the other fields. Even if i press 'F8' all the fields gets displayed with the values.
    But i have a requirement, i.e. after entering 'ID No' and click 'Enter' key , i want all the values to be displayed.
    So i created a 'Key-Enter' trigger with the following code:
    BEGIN
      EXECUTE_QUERY;
    END;
    But after entering 'ID No' and click 'Enter' key, the values are not getting displayed.
    What can i do to make this happen?
    Thank You.

    It depends how your form is created. If your ID item is part of the base table block, you can do this.
    On your ID item, create a KEY-NEXT-ITEM trigger:
    if :system.mode = 'ENTER-QUERY' then
        execute_query;
    else
        next_item;
    end if;
    Now
    - User clicks on enter query (via smart bar icon or F7).
    - User enters ID and clicks <enter> key to execute the query.

  • Key down event to start something an stop arbirtrary

    hallo,
    what I'm trying to do is to start an event on key down an do a loop , something like move an axis for CNC , and this until i press an arbitrary key again.
    i have already a while loop an an event structure so it would be good just to add something withtout large modifications.
    have anyone an example code for me , please.
    i've looked already in a lots of posts but i can't find anything usefull for me.
    many thanks in advance

    again - lots of ways to do this.
    The attached example is just the fastest I could modify the previous version
    2006 Ultimate LabVIEW G-eek.
    Attachments:
    keydownvi3.vi ‏53 KB

  • Key down event handeling when the VI isn't active

    Hi
      I've written a simplel VI that increases or decreases a numerical indicator depending on which key is pressed on the keyboard. But this only works when the VI window is active (the titlebar is blue and not gray). Is there anyway to listen for the key-down event even though the VI is not active?
    In advance thanks
    Georg

    I recently ran into a problem with the Acquire Data.
    See http://forums.ni.com/ni/board/message?board.id=170&message.id=147363
    Just in case....

  • Key down event in background

    Is there a way to make the key down event in the wait event structure run in the background when labview is not the focus? Also what is the difference between the "key down? event" and the "key down event"? I couldn't find a good answer in the LabVIEW help.

    tst wrote:
    To expand a bit on RF's answer, while you can't use the event structure to register for key down events in other windows, there are some potential options:
    You could use the input VIs to poll the keyboard (and you can have a loop which will use a user event to send each new key to an event structure). The main problem with this (and it's a big one) is that it is unreliable. You would have to poll quickly enough (probably at ~20-50 Hz) to have a decent chance of being sure that you're not missing keys and even then it's not guaranteed. The other problem is that you don't know which window was actually in focus.
    You could try getting the window messages from the other window. I have no real experience with Windows messaging, but my understanding is that this will probably require you to write a custom hook in C to get it, but it's possible that this is also possible with the standard Win32 API functions. Even if it is, this is probably not something you want to get into to, but you could try looking it up.
    Actually this Windows Messaging already exists in LabVIEW:
    http://zone.ni.com/devzone/cda/epd/p/id/4394
    However there is a few issues.  It only partially works in Windows 64-bit, and you have to know the handle to the application that you want to intercept key downs for.  I did a quick test and I was able to detect the KEYDOWN event in another VI that was running for for some reason got an error when I tried to get keydown on notepad.  This method would eliminate polling if you can get it to work, and because of this you shouldn't miss any key presses.
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

Maybe you are looking for

  • Add on: Object reference not set to an instance of an object

    This message only appears when each user first installs the add on or every time the add on is started manually.  If it is automatically started it does not happen.  It does not happen in debug mode either. The add-on still runs and works normally af

  • IPhoto Galleries not appearing in Aperture's Moblie Me.

    How do import iPhoto 08 web gallery albums into aperture 2? When I go to Preferences-> Moblie Me I don't see the galleries which have been published from iPhoto.

  • Problem with creatin jar & jad files(wtk 1.4.2)

    Hi, Im devlopping an application & im facing big problem: The application is runing normaly when i build & test it on wtk1.4.2,but when i create package (project-->create package) and go to test the jad im getting a black screen instead of my applica

  • Performance issue session or bean?

    hi, i have a doubt regarding performance issue. actually in my application, five jsp' s need to communicate each other. They share around 15 String Objects. 1. So right now i am using Session object to store these 15 String objects. 2. Also my applic

  • Can I expand?

    I have a 1.25GHz PowerPC G4 iMac that is quickly running out of HD space. I'm thinking about getting an internal 1TB drive. I'm wondering if there's any reason not to do it? I don't have Leopard because I don't have the space on my HD. I have a ton o