Home » Developer & Programmer » Forms » disable text item based on value in previous text item (Forms 6i, Oracle Database 11g Enterprise Edition Release 11.1.0.7.0)
disable text item based on value in previous text item [message #640451] Tue, 28 July 2015 13:47 Go to next message
rkhatiwala
Messages: 178
Registered: April 2007
Senior Member
Hi,

In my form i have user_name, region, case_type.

User can have either region or case-type, so i want to disable case-type if region is populated, and if region is skipped and user goes on to populate case-type, it should make the previou item - region - disabled/grey.

I tried to put the following code in couple of triggers, but it is not disabling, and sometimes getting FRM-40105 error.
   if :rav_regions.region is not null then
       SET_ITEM_PROPERTY(':rav_regions.case_type',ENABLED,PROPERTY_FALSE);
       SET_ITEM_PROPERTY(':rav_regions.case_type',VISUAL_ATTRIBUTE,'VA_NAME');
  end if ;


This should be the case whenever a new record is created.

Thanks,
RK
Re: disable text item based on value in previous text item [message #640453 is a reply to message #640451] Tue, 28 July 2015 15:28 Go to previous messageGo to next message
Littlefoot
Messages: 21807
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Did you try WHEN-VALIDATE-ITEM on RAV_REGIONS.REGION?
Re: disable text item based on value in previous text item [message #640454 is a reply to message #640453] Tue, 28 July 2015 16:11 Go to previous messageGo to next message
rkhatiwala
Messages: 178
Registered: April 2007
Senior Member
I have this,

if :rav_regions.region is not null then
:rav_regions.case_type := NULL ;
-- set_item_instance_propery('case_type', current_record, INSERT_ALLOWED, property_false);
end if;

I want to use set_item_instance_property, but it is giving error saying " set_item_instance_propery has to be decalred".
Re: disable text item based on value in previous text item [message #640471 is a reply to message #640454] Wed, 29 July 2015 02:50 Go to previous messageGo to next message
cookiemonster
Messages: 13920
Registered: September 2008
Location: Rainy Manchester
Senior Member
that's because you haven't spelled property correctly.
Re: disable text item based on value in previous text item [message #640506 is a reply to message #640454] Wed, 29 July 2015 13:39 Go to previous message
CraigB
Messages: 386
Registered: August 2014
Location: Utah, USA
Senior Member
Quote:
if :rav_regions.region is not null then
 :rav_regions.case_type := NULL ;
 -- set_item_instance_propery('case_type', current_record, INSERT_ALLOWED, property_false);
 end if; 

Is there more than one instance of the :RAV_REGIONS.CASE_TYPE item? I got the impression from your description that there is only 1 instance of the CASE_TYPE and REGION items and only one should be enabled if the other has a value. This being the case, you should be using the SET_ITEM_PROPERTY() built-in not the SET_ITEM_INSTANCE_PROPERTY() built-in. The "INSTANCE" version of the built-in is for use when you have an item in a Multi-Row Block.

Quote:
I tried to put the following code in couple of triggers, but it is not disabling, and sometimes getting FRM-40105 error.

Which triggers?

Quote:
This should be the case whenever a new record is created.

If you disable CASE_TYPE in the When-New-Record-Instance, then how can your user choose between which one to use? You should do this in the When-Validate-Item instead so the user can choose between the two options.

Craig...
Previous Topic: How to Check a listbox change in oracle forms
Next Topic: when item validate trg
Goto Forum:
  


Current Time: Thu Apr 18 18:55:20 CDT 2024