This discussion is archived
13 Replies Latest reply: Jul 12, 2013 9:48 AM by KarenH Branched from an earlier discussion. RSS

enable/disable a tabular form item based on the value of a hidden item within tabular form?

KarenH Newbie
Currently Being Moderated

I am trying to enable/disable several items in a tabular form (based on a collection) dependent on the value of a HIDDEN item within that tabular form....


background:

application is in use for commercial fisherman and is used to track species of fish landed along the Atlantic coast.  We are trying to simplify the code initially written in apex 3 by utilizing apex 4.2 and dynamic actions.  The code is inherited and currently relies heavily on javascript, which I am unfamiliar (but slowly slowly trying to learn).

 

The tabular form is a list of fish species, quantity, price, as well as some descriptive info based on the type of species (shellfish, finfish, highly migratory species (HMS) etc).  Depending on the species, different fields are shown/hidden.   The species are loaded when a commercial fisherman selects the species from a tree...this in turn adds a row to the collection.   One of the collection items is c030, which is the only item with a class=HMS.   The value of c030 may be a Y or a N.   If it is a N, the additional fields (with a class of HMS_INFO) should be hidden.

 

example:

if I fisherman selects a species = CLAMS, a check is done behind the scenes against a db table...is CLAMS an hms species, y/n.   If N, then c030 is set to N, and the other fields are hidden as they will make no sense to that species.

If the species selected is TUNA, then c030 is Y (because tuna is an hms). 

 

the fisherman cannot determine which is hms or not, rather a db table of rules does that.  Make sense.

 

problem

 

if I display as text, c030 and change the value to Y/N manually, the following dynamic action properly hides/shows the HMS_INFO fields....however, in the real world, c030 is not displayed and is set behind the scenes when the fisherman selects a species from the tree....so, while the alert in my dynamic action still fires, the hide/show does not.  How can I hide c030 and still have the dynamic action hide/show the HMS_INFO fields?

 

dynamic action:  show/hide hms fields

event: CHANGE

selection type:  JQUERY SELECTOR

jquery selector:  .hms

execute on page load

true action1:  execute javascript code

var el = this.triggeringElement;  
var rowTR = $x_UpTill(el,'TR');  // find the TR for our cell  
if ($v(el) == "N") {    
   $(rowTR).find(".hms_info").hide();  
}  
else {  
   $(rowTR).find(".hms_info").show();  
}

 

true action2: ALERT - checked HMS

 

event scope: DYNAMIC

 

 

thanks for any help!

 

Karen