We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Auto Collapse Empty Custom Fields

Development and Programming

Cocoaholic's avatar
Cocoaholic
445 posts
18 years ago
Cocoaholic's avatar Cocoaholic

What does this extension do?

  • automatically hide Custom fields that are empty
  • automatically show Custom fields that have data

This extension overrides the custom field’s “Show this field by default?” setting.

This version (1.1) works with Mark Huot’s custom field extensions, except for the Geo extension. (I might add that later but I never really got that extension to work yet)

Download link.

EDIT: updated to version 1.1.1

       
seajay's avatar
seajay
109 posts
17 years ago
seajay's avatar seajay

Just found this.

Great!

       
Mark Bowen's avatar
Mark Bowen
12,637 posts
17 years ago
Mark Bowen's avatar Mark Bowen

Inspired, simply inspired!! 😉

Awesome add-on thankyou!! 😊

Best wishes,

Mark

       
seajay's avatar
seajay
109 posts
17 years ago
seajay's avatar seajay

Although I love this extension, it appears that there is a known issue with expanding and collapsing GoogleMaps divs, and I’m using Mark Huot’s geo plugin.

Expanding that CP field in Entry view results in a partial load of the Google Map.

So, I can’t use this one. Sad face here.

       
Laisvunas's avatar
Laisvunas
879 posts
17 years ago
Laisvunas's avatar Laisvunas

Hi Cocoaholic,

Auto Collapse Empty Custom Fields extension if used together with Required Category extension causes a javascript error.

To replicate this error you these steps are needed: 1) install Required category extension 2) set categories to be required for one particular weblog 3) try to post an entry to that weblog without assigning to a category.

Firebug shows this error

el_name has no properties
   if (el_name.substring(0,8)=='field_id') {

It is the line from the script which Auto Collapse Empty Custom Fields extension injects:

<code>//<![CDATA[
form_elements = document.getElementById('entryform').elements;
var id_arr = new Array();
for(i=0; i<form_elements.length; i++) {

el = form_elements;
el_name = el.name;
toggle = 0;

if (el_name.substring(0,8)=='field_id') {</code>
       
Cocoaholic's avatar
Cocoaholic
445 posts
17 years ago
Cocoaholic's avatar Cocoaholic

Hi Laisvunas,

The problem seems to be a combination of both extensions and Firefox!

1 - The Required Category extension shows the Error message using a <fieldset> tag (standard EE behaviour) 2 - The Auto Collapse extension loops through all form elements to fetch the name of each element (the fieldset doesn’t have one) 3 - Firefox treats a fieldset as a form element (which I am not sure it actually is). Safari for instance does not do this and works fine.

If you are on a Windows machine, could you quickly test if this also happens in IE?

I’m looking into a way to prevent the behaviour you are seeing.

       
Cocoaholic's avatar
Cocoaholic
445 posts
17 years ago
Cocoaholic's avatar Cocoaholic

Ok, I found a workaround here and updated the extension to version 1.1.1

Please download again and let me know if this works for you.

       
Laisvunas's avatar
Laisvunas
879 posts
17 years ago
Laisvunas's avatar Laisvunas

Hi Elwin,

Just downloaded and installed updated version of Auto Collapse Empty Custom Fields extension, but Firebug still shows exactly the same error.

I have also checked with IE on Windows - also the same error.

P.S. Updated extension’s version number still is 1.1 build 20070108, so I’m not very sure I really tested updated version.

       
Cocoaholic's avatar
Cocoaholic
445 posts
17 years ago
Cocoaholic's avatar Cocoaholic

Well, must be a browse cache thing, I just downloaded it myself and it’s definitely version 1.1.1 build 20080604.

       
Laisvunas's avatar
Laisvunas
879 posts
17 years ago
Laisvunas's avatar Laisvunas

Hi Elwin,

Just downloaded the true file, tested and found that everything works correctly.

Thank you very much for excellent extension and superfast debugging!

       
gridonic's avatar
gridonic
231 posts
17 years ago
gridonic's avatar gridonic

Perfect, thanks for clarifying this Elwin!

       
walpow's avatar
walpow
133 posts
17 years ago
walpow's avatar walpow

I think I know the answer, but … is there any way to get this to work just on the Edit screen, and not the Publish one? I’d like all my custom fields open when I enter data; but once a entry is made, if a field is empty, I’d like it closed.

Thanks, Nathan

       
Cocoaholic's avatar
Cocoaholic
445 posts
17 years ago
Cocoaholic's avatar Cocoaholic
is there any way to get this to work just on the Edit screen, and not the Publish one?

Sure Nathan, I don’t have time to make that a setting right now, but here is a quick version that does what you want.

Auto Collapse Edit version.

       
walpow's avatar
walpow
133 posts
17 years ago
walpow's avatar walpow

Wow, that’s great. Just what I wanted.

Thanks a million, Nathan

       
Les McKeown's avatar
Les McKeown
133 posts
16 years ago
Les McKeown's avatar Les McKeown

Just found this, and wanted to say ‘Thanks’, Elwin. Great extension(s).

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.