Is there a way to protect fields from manual edition? And a naming convention for such "system" fields?

I have tiddlers hierarchically related to a parent tiddler through a field parent. Those tiddlers also have other content fields I will fill by opening them in edit mode.

  1. I would like to protect the parent field from manual edition.

  2. I also would like to distinguish such a system field from a content field. Is there naming conventions for that in TW community?

  3. Is there a way to combine both by protecting fields having a special prefix?

Might help https://tiddlywiki.com/#Customizing%20EditTemplate%20field%20rendering

1 Like
  • Not that I am aware of and the possibilities changed in a recent release because more characters can now be used in fieldnames
  • I think it a fair assumption that if you created fields with the $:/ prefix that they would be considered system fields.
    • Then modify the edit template field editor not to allow you to edit fields fields with the $:/ prefix, but provide a special field editor for these fields.

There is no special prefix at the moment, but it is possible to create a setup, that you describe. In my examples I do use the prefix “x-” … But you can change that to eg: “parent”.

There is a new Field Editor Cascade that links to a tiddler Customizing EditTemplate field renderingThe description has to be followed exactly. …

Since there are several steps involved, it’s easy to make a typo, so I did add a JSON file here, that works with field prefilxed x-

There is a tiddler :/protected that may be renamed to $:/protected in the production version. But for easier testing I did remove the $ so the tiddler is visible

The value of the :/protected tiddler is used with the edit-text widget, which has a disabled field.

The config tiddler is visible too. Be aware that the tiddler “x-field” contains a filter, where the config-tiddler name needs a $ prefix too in production.

protect-field-1.json (1.1 KB)

2 Likes

Thank you Mario!

I got used to hide any field I don’t like to edit or do not want to allow user to edit it!

But your solution is awesome as user can see the field and its value, but they cannot edit it!

You are welcome.

I did create the field-visibility plugin to be able to hide fields on demand.

It works well with the field-editor plugin. … BUT I will need to update that one, there is a little usability bug atm.

The edit-widget allows a “class” field. So there should be some more visual indication, that the field isn’t editable.

I did add this info to the Tips & Tricks section as a wiki. So everyone is able to improve it.

3 Likes