Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

what is best way to hide/show tab. form columns based on another column val

KarenHMay 24 2013 — edited May 24 2013
Hi Everyone,

I am using apex 4.2. I am proficient in sql/plus and very very very new to jQuery and javascript.

I have created a tabular form based on a view (landings_collection_view) which looks at a collection 'SPECIES_COLLECTION'.

I am able to update/add/delete to my tabular form using dynamic actions.

I am now trying to hide/show several columns based on the value of another column and wondering the best way to do it.

Currently I have:

2 page items:
P113_ID
P113_VALUE

Dynamic action called CHANGE COLUMN:
event: CHANGE
selection type: jQUERY Selector
jQuery:
select[name=#DISPOSITION_CODE#],select[name=#GEAR_CODE#],input[name=#REPORTED_QUANTITY#],input[name=#PRICE#],input[name=#DOLLARS#],select[name=#HMS_AREA_CODE#],input[#FINSATTACHED#],input[#FINSNOTATTACHED#],input[#FINSUNKNOWN#],input[#HMSFLAG#]
event scope: Dynamic

true action#1: set value P113_ID javascript expression this.triggeringElement.id
true action#2: set value P113_VALUE javascript expression this.triggeringElement.value
true action#3: execute pl/sql code
declare

  v_member number;
  v_seq number;

begin 
  v_member := TO_NUMBER (SUBSTR (:p113_id, 2, 2));
  select ltrim(substr(:p113_ID,5,4),'0') into v_seq from dual;

  safis_collections.update_column(v_seq,
                                v_member,
                                :p113_value);
end;
true ation#4 refresh region :LANDINGS_COLLECTION

the tabular form is based on the query:
select 
NULL del_link, 
v.seq_id, 
v.seq_id seq_id_display,
s.common_name||'-'||m.market_desc||'-'||g.grade_desc||'-'||u.unit_desc species,
v.LANDING_SEQ,
v.SPECIES_ITIS,
v.GRADE_CODE,
v.MARKET_CODE,
v.UNIT_MEASURE,
v.DISPOSITION_CODE,
v.GEAR_CODE,
v.REPORTED_QUANTITY,
v.PRICE,
v.DOLLARS,
v.AREA_CODE_FLAG,
v.C014,
v.ADDITIONAL_MEASURE_FLAG,
v.ADDNL_REPORTED_QUANTITY,
v.ADDNL_UNIT_QUANTITY,
v.AREA_FISHED,
v.SUB_AREA_FISHED,
v.LOCAL_AREA_CODE,
v.FINS_FLAG,
v.FINSATTACHED,
v.FINSNOTATTACHED,
v.FINSUNKNOWN,
v.FINS_CODE,
v.EXPLANATION,
v.NATURE_OF_SALE,
v.HMS_AREA_CODE,
v.SALE_PRICE,
v.HMS_FLAG
from  LANDINGS_COLLECTION_VIEW v, 
      species s, 
      market_categories m, 
      grade_categories g, 
      units_of_measure u
where v.species_itis = s.species_itis and 
      v.market_code = m.market_code and 
      v.grade_code = g.grade_code and
      v.unit_measure = u.unit_measure
the column HMS_FLAG is hidden and the value is Y or N. It is loaded when a species is selected from a tree. If the value is 'Y' then I would like to show the column FINSATTACHED, FINSNOTATTACHED, and FINSUNKNOWN. If it is set to 'N' then those columns should be hidden.

I am not certain if this logic should be a new Dynamic Action or another true action added to the dynamic action CHANGE COLUMN and wondered your thoughts.

of course, I also want the answer. sigh. How do I do this? what are the statements I should be looking for? can it be done with pl/sql to reference a column/row in a tabular form...or is javascript the only way?

thank you!

Karen
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2013
Added on May 24 2013
3 comments
1,219 views