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: [Tom P] ShowHide Plugin Question

By nmsinc - February 3, 2012

Hi Tom,



I did copy it wrong!



Checked my keys and the array’s and they are all correct!



Also, I tried shifting the blocks around, again, only the last block works. I have never needed to have more than one field hidden on one submission form so this has never been an issue!

Thanks - nmsin
nmsinc

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