Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2022-11-11 12:12:28

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

Write panel, saving with keyboard shortcut

Today we found a rather weird behaviour while using the Save keyboard shortcut on the Write panel (Safari, Firefox – Chromium based browsers not tested).

  • create a new article
  • don’t fill any field
  • press the keyboard shortcut (cmd/ctrl S)
  • the article is saved – message pane (warning!): “ Article posted. URL-only title was left blank. ”

The article is listed On the articles list as Untitled

The browser build-in validation (required fields) is bypassed and the article is saved. On other panels (Forms/Pages/Styles) or Edit pages, although the build-in validation is bypassed, a full fledged error is returned. The form is not saved.

Performing the same steps and pressing the Save / Publish button behaves as expected, the build-in validation detects a (blank) required field and stops any processing.

Or perhaps amusing is a better label for this behaviour on the Write panel.


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

Offline

#2 2022-11-11 15:50:17

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

Re: Write panel, saving with keyboard shortcut

Yeah the Write panel is built differently. Since it is ID based, any incoming Save request adds a new row, regardless of whether the other fields are blank.

Forms, pages and styles are not ID based and they are keyed off the name supplied in the submitted data. If the name is blank, it throws an error.

Not sure what we can do about this. An empty article is technically valid, even though it’s not discoverable (I don’t think??) on the front end.


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 2022-11-12 00:13:59

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

Re: Write panel, saving with keyboard shortcut

Not sure what we can do about this. An empty article is technically valid, even though it’s not discoverable (I don’t think??) on the front end.

I put that under “ weird things can happen when hooking up keyboard shortcuts into a webpage ” :-)

The first thing that surprised me in fact is that in all cases, using the keyboard shortcut bypasses the build-in browser validation (required attribute). And then the Write panel dunno, given all what is going on in with JS there… not sure it is worth thinking too hard about it. It is a weird edge case anyway —as who tries to save the article when all is still empty? I am not sure how my partner “discovered” this, and she does not know either.

As for the empty article – no title no body – yes it does show up on an article list with the default theme.


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