sgt.blikey Posted November 9, 2016 Share Posted November 9, 2016 Howdy, What am I misunderstanding? I have a date time field and have specified that children of template 'home' should be (reverse) ordered by that field the field should default to todays date input and output formats I have added the field to the template 'basic-page'. When, under field settings > input > visibility, I have set it to 'Closed' the field is populated when a new page is created and the page is ordered correctly under Home. When, under field settings > input > visibility, I have set it to 'Hidden (not shown in the editor)' the field is populated when a new page is created but the page is ordered incorrectly under Home and subsequent reloads of the page tree do not resolve the issue. Changing the option for the field back to 'Closed' doesn't reorder the pages under Home according to the rule. Why is that happening? Nic Link to comment Share on other sites More sharing options...
Robin S Posted November 9, 2016 Share Posted November 9, 2016 31 minutes ago, sgt.blikey said: When, under field settings > input > visibility, I have set it to 'Hidden (not shown in the editor)' the field is populated when a new page is created Are you sure of this? I tested it quickly and it seems to not populate the field when set to hidden. If the inputfield is hidden then I expect its render method is never called so no default value is entered into it. Is there a difference between what you're wanting to do with this field and the "created" property that exists by default when adding a new page? Because if your field is hidden then nobody could ever edit it so it would always remain identical to the created datetime. So could you just sort your pages by "created"? 1 Link to comment Share on other sites More sharing options...
sgt.blikey Posted November 9, 2016 Author Share Posted November 9, 2016 8 minutes ago, Robin S said: Are you sure of this? I tested it quickly and it seems to not populate the field when set to hidden. If the inputfield is hidden then I expect its render method is never called so no default value is entered into it. How do you determine whether the field has been populated? If the field is hidden, where do you view the content of the field? I mean, if a field is hidden and auto-populated, how can you see its value? Link to comment Share on other sites More sharing options...
sgt.blikey Posted November 9, 2016 Author Share Posted November 9, 2016 14 minutes ago, Robin S said: Is there a difference between what you're wanting to do with this field and the "created" property that exists by default when adding a new page? Because if your field is hidden then nobody could ever edit it so it would always remain identical to the created datetime. So could you just sort your pages by "created"? Oh, I forgot about that field. That is what I need, but I'm curious about the above. Link to comment Share on other sites More sharing options...
Robin S Posted November 9, 2016 Share Posted November 9, 2016 1 minute ago, sgt.blikey said: If the field is hidden, where do you view the content of the field? 1. You can get the field value with $page->my_datetime and log it, dump it with Tracy Debugger, or echo it on the frontend. 2. You can check the database table for the field in PhpMyAdmin or similar. 2 Link to comment Share on other sites More sharing options...
sgt.blikey Posted November 9, 2016 Author Share Posted November 9, 2016 35 minutes ago, Robin S said: Are you sure of this? I tested it quickly and it seems to not populate the field when set to hidden. If the inputfield is hidden then I expect its render method is never called so no default value is entered into it. No, I'm not sure of this actually. I've been changing the visibility setting from hidden to something else, e.g. closed. Subsequently, when viewing the page, the field is populated, but I haven't tested whether the value is correct-ish so I do not know whether the field is populated when the page is created or when the attribute is changed from hidden to closed. Link to comment Share on other sites More sharing options...
Robin S Posted November 9, 2016 Share Posted November 9, 2016 2 minutes ago, sgt.blikey said: I've been changing the visibility setting from hidden to something else, e.g. closed. To test it you'd need to set the inputfield to Hidden, create a new page, then check the value as described above. If it's an existing page that was previously edited when the field was set to Open or Closed (i.e. anything that actually rendered the inputfield) then the value will remain populated even after you change the inputfield to Hidden. That's because changing the inputfield to hidden wouldn't delete field data from the DB. 2 Link to comment Share on other sites More sharing options...
sgt.blikey Posted November 9, 2016 Author Share Posted November 9, 2016 7 hours ago, Robin S said: Are you sure of this? I tested it quickly and it seems to not populate the field when set to hidden. If the inputfield is hidden then I expect its render method is never called so no default value is entered into it. You're right, the hidden version of the field is not populated. The field is populated only after changing its visibility to something other than hidden, and then editing/saving a page. Thanks for clearing that up. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now