Customizing EditTemplate field rendering

(Windows 10, Firefox 98.0.2, TW 5.2.2, timimi)

Can someone walk slowly through the example on the TiddlyWiki site in the above named tiddler? It’s for changing the default text box of a field called date to show … the date? anywhere a date field is requested. Since I don’t know what the output is supposed to be, I’m having a hard time figuring out if I’m doing the example correctly.

I want to change the default rendering of a specified field (notes) from text box to text area, in every tiddler that has a field called notes.

I get the impression there are three tiddlers needed, 1-the tiddler that tells TW to use another tiddler to override the default field rendering, 2-the tiddler that identifies the date field in a tiddler and changes it to a type=date, and 3-an example tiddler that actually shows the first two tiddlers working as described. If this understanding is all wrong, I need some real hand-holding, here.

1 Like

Here is what I have going on, and it’s not working. I’ve laid out the instructions in the page “Customizing EditTemplate field rendering” to suit what I think it is trying to get across, and not having any luck.

Part 1

To modify the appearance of all fields whose name ends with-notes create a new tiddler…

  1. Create a tiddler.

  2. Add the tag “$:/tags/FieldEditorFilter” to the unnamed tiddler.

  3. Add a field named “list-before” and put “$:/config/FieldEditorFilters/default” in the value

  4. Type this into the text area of the unnamed tiddler: “[regexp[-notes$]then[$:/config/EditTemplateFields/Templates/notes]]”.

  5. Give this tiddler the name “Change the notes field”

Part 2

The variables currentTiddler and currentField are set to pass information about the tiddler and field that are edited to the transcluded tiddler.

For example, a tiddler containing the following WikiText would render the field as an HTML input element of the type textarea. This will show a box for multiple lines of text to be entered.

<$edit-text tiddler=<<currentTiddler>> field=<<notes>> type="textarea" class="tc-edit-texteditor" placeholder="" tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>

(I think this is what should be named $:/config/EditTemplateFields/Templates/notes, because the instructions to change the field rendering are in this tiddler. The directions to transclude it into a new tiddler are in the previous tiddler.)

  1. Create a new tiddler.

  2. Type this into the text area of the unnamed tiddler: "<$edit-text tiddler=<<currentTiddler>> field=<<notes>> type="textarea" class="tc-edit-texteditor" placeholder="" tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>".

  3. Give this tiddler the name $:/config/EditTemplateFields/Templates/notes

This doesn’t work. I’ve tried it with the date example, of course, and that didn’t work. I’m just unclear where to put the “<edit-text…” stuff to make it effective.

I tried it by using a button that creates a tiddler with prenamed fields, one of which is “notes”. The tiddler created does not have the note field input become a textarea.

Welcom @Farouche

Before we assist please edit your posts and wrap your code snipits using the code button on the discource tool bar. Currently they are mangled.

.also in the first post you say “above named tiddler” to what is this refering?

The tiddler created in part 1. I can’t seem to understand the example given in the page “Customizing EditTemplate field rendering” that’s on the TiddlyWiki site. So I worked through each sentence and tried to figure out what they are doing. It appears to me that you create a tiddler to tell the tiddler creation to add some instruction via a transclusion - part 1. You then create the tiddler to be transcluded with the instructions you want - part 2.

You then create a tiddler that will utilize the new transclusion for the special field. I used a button that creates a new tiddler with the field I want. It does so, but it doesn’t change the field from text field to text area.

1 Like

I’m definitely no expert but in part 2 step 2 you have field=<<notes>> and this should follow exactly what the example says: field=<<currentField>> . I’m not sure of the terminology, but AFAIK, which isn’t very far, << >> notation refers to macros that take variables. A specific field would be field="note"

Thanks, I’ll give that a try.

Got this to work: <$edit-text tiddler=<<currentTiddler>> field=<<currentField>> type="text" tag= "textarea" class="tc-edit-texteditor" placeholder="field value" tabindex={{$:/config/EditTabIndex}} cancelPopups="yes"/>

What I was doing wrong was thinking the type was the textarea, but it’s tag=textarea.

2 Likes