ShowHide Plugin Question

By nmsinc - February 3, 2012

Using ShowHide Plugin version 0.03

I need to hide two fields in one section. I coded each block, however, the last block is the only one one that works. See code blocks below - looking for suggestions - Thanks nmsinc

// For each section and list field, copy this block
// Fields will start hidden if they appear in any "fields to show" list
$GLOBALS['SHOWHIDE_DEPENDANT_FIELDS_CONFIG']['submission']['status'] = array(
// list option => fields to show
'' => array(), // show these fields when the topmost '<select>' option is selected
'Other' => array('status_other'),
'_any_value_' => array(), // show these fields when a value not listed above is selected
);
// For each section and list field, copy this block
// Fields will start hidden if they appear in any "fields to show" list
$GLOBALS['SHOWHIDE_DEPENDANT_FIELDS_CONFIG']['submission']['assign'] = array(
// list option => fields to show
'' => array(), // show these fields when the topmost '<select>' option is selected
'Yes' => array('date_re_assigned',company_name','number'),
'_any_value_' => array(), // show these fields when a value not listed above is selected
);
nmsinc

Re: [nmsinc] ShowHide Plugin Question

By (Deleted User) - February 3, 2012

Hi nmsinc,

If you've copied the code as is, then there's an apostrophe (') missing in the second loop:
'Yes' => array('date_re_assigned',company_name','number'),
should be
'Yes' => array('date_re_assigned','company_name','number'),

To check that the function is being used correctly:
The first key is the table name
The second key is the field name

Then the arrays inside the function:
'List Option Text' => array('field to show/hide','another field to show/hide','another field to show/hide'),


Let me know if this helps,

Tom

Re: [nmsinc] ShowHide Plugin Question

By (Deleted User) - February 3, 2012

Hi nmsinc,

I've just tried the plugin as written (replacing the table and field names with those from my test tables) and it works.

If this is for the site I think it's for, try these two blocks instead:
// For each section and list field, copy this block
// Fields will start hidden if they appear in any "fields to show" list
$GLOBALS['SHOWHIDE_DEPENDANT_FIELDS_CONFIG']['claims_submission']['assign_to_independent_claim_company'] = array(
// list option => fields to show
'' => array(), // show these fields when the topmost '<select>' option is selected
'Yes' => array('date_re_assigned','independent_company_name','number'),
'_any_value_' => array(), // show these fields when a value not listed above is selected
);



// For each section and list field, copy this block
// Fields will start hidden if they appear in any "fields to show" list
$GLOBALS['SHOWHIDE_DEPENDANT_FIELDS_CONFIG']['claims_submission']['claim_status'] = array(
// list option => fields to show
'' => array(), // show these fields when the topmost '<select>' option is selected
'Other' => array('status_other'),
'_any_value_' => array(), // show these fields when a value not listed above is selected
);


NOTE: I wasn't sure which field "number" was referring to, but replace "number" with the fieldname (from General Settings->Section Editors->claims_submission) that you want and it should be fine.
NOTE: I don't have a "status_other" field in the local copy of "claims_submissions" so I tested it with "member_company_claim_id" which behaved as expected.


Let me know if this helps,

Tom

Re: [Tom P] ShowHide Plugin Question

By nmsinc - February 3, 2012

Hi Tom,

You have the correct site - I used your suggestion and still have the same problem - the last block still does not work!

Thanks - nmsinc
nmsinc

Re: [nmsinc] ShowHide Plugin Question

By (Deleted User) - February 3, 2012

Hi nmsinc,

I found the problem - the function was not designed to a have more than one call per table and since both of your calls were on the same table it only dealt with the last one.

I've fixed that now and uploaded it.

Let me know if there are any problems,

Tom

Re: [Tom P] ShowHide Plugin Question

By nmsinc - February 4, 2012

Thanks Tom for making the updates on this plugin so quickly, works great now!
nmsinc