4 Replies Latest reply: Jun 3, 2013 11:07 PM by Bhushan53 RSS

    Need to enable a Field in oracle form- Urgent

    1012270
      I have a search from where i need to fill the customer number and if its a valid customer number it should automatically enable the next filed ie.. customer name. Can not use the 'TAB' out functionality on customer number to enable customer name.
      Can anyone say me the logic for it
        • 1. Re: Need to enable a Field in oracle form- Urgent
          GregorM
          Hi.

          You should use item properties insert_allowed and update_allowed instead of item enabled property. The reason is the navigation can not occur to a non enabled item but it can on enabled item with property insert_allowed or/and update_allowed set to false.

          Best regards.
          • 2. Re: Need to enable a Field in oracle form- Urgent
            Srikkanth.M
            Hi,

            You can put your code in when-new-iten-instance like this.

            Just make the Insert allowed and updated allowed as no in the property palette. And then write a code in the when-new-item-instance
            like this.

            declare
            v_emp_no number;
            begin
            Select count(emp_no) from table where emp_no=:block.field_name;
            If count >1 then
            set_item_instance_property('Block.field_name',CURRENT_RECORD,UPDATE_ALLOWED,PROPERTY_TRUE);
                 set_item_instance_property('Block.field_name',CURRENT_RECORD,INSERT_ALLOWED,PROPERTY_TRUE);

            Else
            Make it as false.

            End if;

            Try this.

            Regards
            Sri
            • 3. Re: Need to enable a Field in oracle form- Urgent
              CraigB
              Can you show us what you have tried?

              Is the item being "enabled" in a "Form layout" or "Tabular Layout"? If Form Layout, you can use the SET_ITEM_PROPERTY('ITEM_NAME',ENABLED, PROPERTY_TRUE) method. If your item is in a Tabular Layout, then you can't ENABLE or DISABLE the item because there is no built-in method for doing this. Instead, you can set the item as INSERT or UPDATE_ALLOWED as Sri indicated.

              Also, it is helpful to know what Forms version you are using.

              Craig...
              • 4. Re: Need to enable a Field in oracle form- Urgent
                Bhushan53
                What I understand from the question is, you want the customer name field getting enabled without 'tab'bing out of customer number?
                Maybe you can use the post-text trigger in the customer number field to set the properties of customer name as Sri and Craig suggested.

                An alternative approach would be,

                1. Keep both the items enabled.
                2. In the when-new-item-instance trigger of customer name write this code -

                IF <customer_num NOT valid OR customer_num IS NULL> THEN
                message('FRM-XYZ Invalid Customer Number.');
                go_item('customer_num');
                END IF;
                This obviously, won't disable any item but serve your purpose w/o much hassles.

                Regards
                Bhushan