4 Replies Latest reply on Jun 4, 2013 4:07 AM by Bhushan53

    Need to enable a Field in oracle form- Urgent

      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

          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

            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.

            v_emp_no number;
            Select count(emp_no) from table where emp_no=:block.field_name;
            If count >1 then

            Make it as false.

            End if;

            Try this.

            • 3. Re: Need to enable a Field in oracle form- Urgent
              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.

              • 4. Re: Need to enable a Field in oracle form- Urgent
                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.');
                END IF;
                This obviously, won't disable any item but serve your purpose w/o much hassles.