Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2025-01-26 06:29:47

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,284
Website

Date format wrong type of select

The select widget for Preferences > Site > “Date format” an “Archived dated format” now displays as a select multiple. That seems an error somewhere. I have a hard time thinking why I would have multiple types for one “Date format”.

That is a recent change – maybe this: github.com/textpattern/textpattern/commit/b19c4a85e6e06019dfe9f6adee088aca0ae6b500

PHP 8.3 & 8.4


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#2 2025-01-26 10:40:41

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,560
Website GitHub

Re: Date format wrong type of select

Drat. Some of the date formats have commas in them, which means they’re getting split at that character, so it presumes the select is a multi-select. That’s tricky.

It would have still been broken, before that commit you referenced. If you select any of the items with a comma in them, the value will not be preselected when you revisit the page. Sadly, to fix this is not simply a case of forcing the select to be single, which is easy to do.

More thought required on how to handle values that contain commas in them. Hmmmm.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#3 2025-01-26 12:19:08

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,560
Website GitHub

Re: Date format wrong type of select

The simplest thing to do would be to pass the date format’s selected value to the UI library as an array. That way, it won’t get passed through do_list() and therefore won’t be split at comma.

The trouble is that the prefs tend to be handled by generic functions so it might be tricky in some cases. But I think in this case both are handled by a dedicated function because they’re treated as special cases, so it might be relatively painless.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2025-01-26 12:50:57

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,560
Website GitHub

Re: Date format wrong type of select

That is indeed the best way, as I mentioned above. Fixed. Thanks for the report.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#5 2025-01-26 13:05:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,560
Website GitHub

Re: Date format wrong type of select

Incidentally, this also affects the Override Form Types select list. It should be multiple.

EDIT: Fixed too

Last edited by Bloke (2025-01-26 13:18:55)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#6 2025-01-27 01:20:16

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,284
Website

Re: Date format wrong type of select

Thanks. Both work / behave / display as expected now.

Great explanation of the issue at hand. When verifying on dev-demo I was at first puzzled – the “Date format” select displayed as a single select. But that makes sense now, the default is relative date (“days/hours ago”). That is, without any comma in the node.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

Board footer

Powered by FluxBB