Jump to content

"Blank and 0 have different meanings" - not working for display in the CMS itself


cjx2240
 Share

Recommended Posts

I'm using this option on integer field types, however I have a bit of an issue

In the CMS, if I set the field to "Open when populated + Closed when blank + Locked (not editable)" - the field does not appear at all - even the header - if the value is 0. As this data is managed by an import, I only want to display it in the CMS, not have it editable. The zero has saved, I can see it in the database.

If it makes any difference this is a group of integer fields inside Profields:Textareas however I think they behave the same as any integer field, or at least any integer within a repeater or other group of fields.

What's odd is that an empty text string doesn't have this problem on type: text.

Seemingly there is some check that's happening, either when looping through the Profields:Textareas fields, or when simply checking for "Closed when blank", which is not taking the "0" as a number into account.

Am I missing anything, is there something I could tweak to make this work properly?

Link to comment
Share on other sites

  • cjx2240 changed the title to "Blank and 0 have different meanings" - not working for display in the CMS itself

I didn't try it out inside a Textareas field, but these settings work for me. Did you use HTML5 number input or text? (shouldn't really matter)

If it also works for you outside of Textareas, perhaps you should better post it in the Pro forum thread instead, to get Ryan's attention.

Link to comment
Share on other sites

  • 2 weeks later...

For me, it happens with any field.

As soon as you set it to "Open when populated + Closed when blank + Locked (not editable)" - it vanishes from the CMS. While editable, it appears, with a 0 in it. Using HTML5 input doesn't help.

The same thing happens if you set access level to view and not edit.

The best thing I can think to do is leave the fields open and forcibly make them disabled with javascript or a hook instead.

On a related note once I changed a textareas field to use HTML 5 input, I started getting this error on every save:

  • InputfieldForm: Warning ('showIf' from 'Markup/HTML (Content Type)'): dependency field 'contentType' is not present in this form. - ProcessFieldEdit
But my profields license expired a long time ago so I can't do much about this. Is there somewhere to report both these issues?
 
Link to comment
Share on other sites

  • 2 weeks later...

On the off-chance that anyone else stumbles on this and thinks it's a solution for what they need, you should set the field to readonly, instead of disabled. Otherwise ProcessWire looks for a value, doesn't find one, and saves it as empty, meaning you'll wipe all the fields on a save.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...