ShowHide Plugin Question
7 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: February 4, 2012 (RSS)
By nmsinc - February 3, 2012
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
);
Re: [nmsinc] ShowHide Plugin Question
By (Deleted User) - February 3, 2012
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
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
Re: [nmsinc] ShowHide Plugin Question
By (Deleted User) - February 3, 2012
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
You have the correct site - I used your suggestion and still have the same problem - the last block still does not work!
Thanks - nmsinc
Re: [nmsinc] ShowHide Plugin Question
By (Deleted User) - February 3, 2012
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