Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
ShowHide Plugin Question

 

 


nmsinc
User

Feb 3, 2012, 11:55 AM

Post #1 of 7 (1244 views)
Shortcut
ShowHide Plugin Question Can't Post

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
);


Tom P
User


Feb 3, 2012, 3:04 PM

Post #2 of 7 (1236 views)
Shortcut
Re: [nmsinc] ShowHide Plugin Question [In reply to] Can't Post

Hi nmsinc,

If you've copied the code as is, then there's an apostrophe (') missing in the second loop:

Code
'Yes' => array('date_re_assigned',company_name','number'),

should be

Code
'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


nmsinc
User

Feb 3, 2012, 4:10 PM

Post #3 of 7 (1232 views)
Shortcut
Re: [Tom P] ShowHide Plugin Question [In reply to] Can't Post

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


Tom P
User


Feb 3, 2012, 4:29 PM

Post #4 of 7 (1229 views)
Shortcut
Re: [nmsinc] ShowHide Plugin Question [In reply to] Can't Post

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:

Code
 
// 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


nmsinc
User

Feb 3, 2012, 4:51 PM

Post #5 of 7 (1225 views)
Shortcut
Re: [Tom P] ShowHide Plugin Question [In reply to] Can't Post

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


Tom P
User


Feb 3, 2012, 5:21 PM

Post #6 of 7 (1222 views)
Shortcut
Re: [nmsinc] ShowHide Plugin Question [In reply to] Can't Post

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


nmsinc
User

Feb 4, 2012, 6:51 AM

Post #7 of 7 (1166 views)
Shortcut
Re: [Tom P] ShowHide Plugin Question [In reply to] Can't Post

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