Read carefully the "Notes" section of that link you just referenced. You need to edit a field that is not in the tiddler that contains the EditTextWidget. The notes give you an example how to do that. It can be worked around.
/Mike
Hi Jake,Read carefully the "Notes" section of that link you just referenced. You need to edit a field that is not in the tiddler that contains the EditTextWidget. The notes give you an example how to do that. It can be worked around.
What this means in your specific example is since your EditTextWidget and the field that your are editing are in your DataEntry tiddler, it will force a refresh of the EditTextWidget with every keystroke ... even if you transclude it into another tiddler. You are best to tweak your DataEntry EditTextWidget with tiddler=DataStorage so that the widget is in the DataEntry tiddler and the field being edited is in DataStorage tiddler.
For sure, it is an annoying limitation and an easy trap to fall in considering that the default tiddler for the widget is currentTiddler but once you get things working, it is easy problem to avoid. I banged my head on this one for a while.
/Mike
Do some reading on how the <$list> and <$tiddler> widgets and templates can affect the value of currentTiddler before being dismissive. There is good reason why the default target of a lot of widgets is currentTiddler that makes it appropriate in 99.9% of use-cases.
Also understand the use of variables, macros and TextReferences to assign the values to widget parametersbsince they open up a world of flexibility to your Tiddlywiki applications and avoid having to manually change code.
/Mike
From EditTextWidget:
"One trap to be aware of is that the edit text widget cannot be used to edit a field of the tiddler that contains it. Each keypress results in the tiddler being re-rendered, which loses the cursor position within the text field."
\define input(fieldname)
<$vars
temp="$:/temp/$(currentTiddler)$/$fieldname$"
default={{{ [<currentTiddler>get[$fieldname$]] }}}
placeholder="enter a value for $fieldname$">
<$keyboard key="enter" actions="""
<$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" $value={{{ [<temp>get[text]] }}} />
<$action-deletetiddler $filter="[<temp>]" />
""">
<$edit-text tag="input" tiddler=<<temp>> default=<<default>> placeholder=<<placeholder>>/>
</$keyboard>
<$button tooltip="delete field"> {{$:/core/images/delete-button}}
<$action-deletefield $tiddler=<<currentTiddler>> $field="$fieldname$"/>
<$action-deletetiddler $filter="[<temp>]" />
</$button>
<$button tooltip="cancel input"> {{$:/core/images/cancel-button}}
<$action-deletetiddler $filter="[<temp>]" />
</$button>
<$button tooltip="save input"> {{$:/core/images/done-button}}
<$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" $value={{{ [<temp>get[text]] }}} />
<$action-deletetiddler $filter="[<temp>]" />
</$button>
</$vars>
\end
<<input "foo">>Here's a macro that provides a work-around interface:
How to use it:* copy the above code into a tiddler (e.g., "$:/TiddlyTools/Macros/getinput")* tag that tiddler with "$:/tags/Macro"* in any other tiddler, write:<<input "foo">>How it works:* the $edit-text default value is the current value in "SomeField" of "SomeTiddler"* the $edit-text input goes into a temporary tiddler named $:/temp/SomeTiddler/SomeField* the "delete" button removes "SomeField" from "SomeTiddler"* the "cancel" button discards the temporary tiddler (automatically reverting the input contents to showing the default value)* the "ok" button copies the temporary tiddler content to "SomeField" in "SomeTiddler"* the "enter" key is a shortcut for pressing "ok"I'm also working on an enhanced version where the buttons appear as a "popup"only when the $edit-text control gets the input focus, but I'm still debugging thatversion (there's a strange interaction between the focus and the popup that Ihaven't yet figured out).

I'm also working on an enhanced version where the buttons appear as a "popup"only when the $edit-text control gets the input focus, but I'm still debugging thatversion (there's a strange interaction between the focus and the popup that Ihaven't yet figured out).
\define inputpopup(fieldname)
<$vars
temp="$:/temp/$(currentTiddler)$/$fieldname$"
popup=<<qualify "$:/state/popup/$(currentTiddler)$/$fieldname$">>
default={{{ [<currentTiddler>get[$fieldname$]] }}}
placeholder="enter a value for $fieldname$">
<$keyboard key="enter" actions="""
<$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" $value={{{ [<temp>get[text]] }}} />
<$action-deletetiddler $filter="[<popup>] [<temp>]" />
""">
<$edit-text tag="input" tiddler=<<temp>> default=<<default>> placeholder=<<placeholder>> focusPopup=<<popup>> class="tc-popup-handle"/>
</$keyboard>
<$reveal state=<<popup>> type="popup" text="" position="right" style="margin-left:0.25em;">
<$button tooltip="delete field"> {{$:/core/images/delete-button}}
<$action-deletefield $tiddler=<<currentTiddler>> $field="$fieldname$"/>
<$action-deletetiddler $filter="[<popup>] [<temp>]" />
</$button>
<$button tooltip="cancel input"> {{$:/core/images/cancel-button}}
<$action-deletetiddler $filter="[<popup>] [<temp>]" />
</$button>
<$button tooltip="save input"> {{$:/core/images/done-button}}
<$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" $value={{{ [<temp>get[text]] }}} />
<$action-deletetiddler $filter="[<popup>] [<temp>]" />
</$button>
</$reveal>
</$vars>
\end
<<inputpopup "foo">>enjoy,-e
Here's the version that uses the focusPopup="..." method, so that the delete/cancel/ok buttonsonly appear when you put the cursor into the input field
\define inputbutton(fieldname,width:"12em",style:"2px inset")
<$vars
temp="$:/temp/$(currentTiddler)$/$fieldname$"
default={{{ [<currentTiddler>get[$fieldname$]] }}}
placeholder="enter a value for $fieldname$">
<$list filter="[<temp>!is[tiddler]]" variable="inactive">
<$button class="tc-btn-invisible" style="width:$width$;text-align:left;white-space:nowrap;border:$style$" set=<<temp>> setTo=<<default>>>
<$reveal default=<<default>> type="match" text=""><$text text=<<placeholder>>/></$reveal>
<$reveal default=<<default>> type="nomatch" text=""><$text text=<<default>>/></$reveal>
</$button>
</$list>
<$list filter="[<temp>is[tiddler]]" variable="active">
<$keyboard key="enter" actions="""
<$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" $value={{{ [<temp>get[text]] }}} />
<$action-deletetiddler $filter="[<temp>]" />
""">
<$edit-text tag="input" tiddler=<<temp>> default=<<default>> placeholder=<<placeholder>>/>
</$keyboard>
<span style="position:relative;">
<span style="position:absolute;width:7em;">
<$button tooltip="delete field" style="display:inline-block;width:2em"> {{$:/core/images/delete-button}}
<$action-deletefield $tiddler=<<currentTiddler>> $field="$fieldname$"/>
<$action-deletetiddler $filter="[<temp>]" />
</$button>
<$button tooltip="cancel input" style="display:inline-block;width:2em"> {{$:/core/images/cancel-button}}
<$action-deletetiddler $filter="[<temp>]" />
</$button>
<$button tooltip="save input" style="display:inline-block;width:2em"> {{$:/core/images/done-button}}
<$action-setfield $tiddler=<<currentTiddler>> $field="$fieldname$" $value={{{ [<temp>get[text]] }}} />
<$action-deletetiddler $filter="[<temp>]" />
</$button>
</span>
</span>
</$list>
</$vars>
\end
A little question: what if I want this template to appear/disappear with a click of a button?
I didn't follow the intricacies of this thread but to make something appear/disappear with the click of a button you can use the RevealWidget as described here (see section "Accordion or Slider") OR, since you refer to it as a "template" then maybe that means it si something that has a critical tag for it to enable/disable it, in which case you can use e.g the CheckBoxWidget to toggle that tag.
\define db() $(currentTiddler)$-db\define dbformstate() $(currentTiddler)$-formstate
\define ToggleEditFld(formName, tagValue, fieldType, fieldName, helpText)<$reveal type="nomatch" stateTitle=<<dbformstate>> stateIndex="$formName$" text="show"><$tiddler tiddler=<<db>>>{{##$formName$-$fieldName$}}</$tiddler> </$reveal><$reveal type="match" stateTitle=<<dbformstate>> stateIndex="$formName$" text="show"><$edit-text tiddler=<<db>> tag=$tagValue$ type=$fieldType$ index="$formName$-$fieldName$"/><button class="tc-btn-invisible tc-btn-help" title="$helpText$" aria-label="help">{{|| $:/core/images/help}}</button></$reveal>\end
\define ToggleEditBtn(formName)<$reveal type="nomatch" stateTitle=<<dbformstate>> stateIndex="$formName$" text="show"><$button type="button" class="btn btn-danger" setTitle=<<dbformstate>> setIndex="$formName$" setTo="show">Edit</$button></$reveal><$reveal type="match" stateTitle=<<dbformstate>> stateIndex="$formName$" text="show"><$button type="button" class="btn btn-success" setTitle=<<dbformstate>> setIndex="$formName$" setTo="hide">Save</$button></$reveal>\end
<table><tr><td>
|thead-primary table-caption-top|k|''Table-Caption''|c|Title|Details||h|''URL Field'' |<<ToggleEditFld form1 input url dt_url "Enter [[Sometext|http://www.google.com]] to display Sometext as hyperlink for URL: https://www.google.com">> | <<ToggleEditBtn form1>> ||''Work Email Address'' |<<ToggleEditFld form1 input email work_email_address "Enter Email">> |~||''Other Email Address'' |<<ToggleEditFld form1 input email other_email_address "Enter other Email">> |~||''Home Phone Number'' |<<ToggleEditFld form1 input tel home_phone_number "Enter Home phone">> |~||''Cell Phone Number'' |<<ToggleEditFld form1 input tel cell_phone_number "Enter Cell phone">> |~||''Start Date'' |<<ToggleEditFld form1 input date start_date "Enter Start Date">> |~||''Colour'' |<<ToggleEditFld form1 input color form_colour "Select Colour">> |~||''Blurb'' |<<ToggleEditFld form1 textarea textarea blurb "Type <br> to display break between lines">> |~||''Single Line Input'' |<<ToggleEditFld form1 input text single_line_input "Some one line text">> |~|
</td><td>
|thead-primary table-caption-top|k|''Table-Caption''|c|Title|Details|h|''URL Field'' |<<ToggleEditFld form2 input url dt_url "Enter [[Sometext|http://www.google.com]] to display Sometext as hyperlink for URL: https://www.google.com">> ||''Work Email Address'' |<<ToggleEditFld form2 input email work_email_address "Enter Email">> ||''Other Email Address'' |<<ToggleEditFld form2 input email other_email_address "Enter other Email">> ||''Home Phone Number'' |<<ToggleEditFld form2 input tel home_phone_number "Enter Home phone">> ||''Cell Phone Number'' |<<ToggleEditFld form2 input tel cell_phone_number "Enter Cell phone">> ||''Start Date'' |<<ToggleEditFld form2 input date start_date "Enter Start Date">> ||''Colour'' |<<ToggleEditFld form2 input color form_colour "Select Colour">> ||''Blurb'' |<<ToggleEditFld form2 textarea textarea blurb "Type <br> to display break between lines">> ||''Single Line Input'' |<<ToggleEditFld form2 input text single_line_input "Some one line text">> ||>| ~o~ |<||>| <<ToggleEditBtn form2>> |<|
</td></tr></table>
<$set name="formNamevar" value="form3">
|thead-primary table-caption-top|k|''Table-Caption''|c|Title|Details|h|''URL Field'' |<$macrocall $name="ToggleEditFld" formName=<<formNamevar>> tagValue="input" fieldType="url" fieldName="dt_url" helpText="Enter [[Sometext|http://www.google.com]] to display Sometext as hyperlink for URL: https://www.google.com" /> ||''Work Email Address'' |<$macrocall $name="ToggleEditFld" formName=<<formNamevar>> tagValue="input" fieldType="email" fieldName="work_email_address" helpText="Enter Email" /> ||>| ~o~ |<||>| <$macrocall $name="ToggleEditBtn" formName="form3" /> |<|
</$set><<ToggleEditFld form2 input url dt_url "Enter [[Sometext|http://www.google.com]] to display Sometext as hyperlink for URL: https://www.google.com">>
<$macrocall $name="ToggleEditFld" formName="form1" tagValue="input" fieldType="url" fieldName="dt_url" helpText="Enter [[Sometext|http://www.google.com]] to display Sometext as hyperlink for URL: https://www.google.com" />
If you are trying to create a form, I figured the easiest approach was to just store the data of your form on a data tiddler. All this can then be done while giving complete flexibility on different field types. If you create a form template and then use that template to create new tiddlers using {{||template}} that should just work.Code below shows examples of various HTML field types :
|Title|Value|h|!Input Text |<$edit-text tiddler="testdb" placeholder="Input text-field" index="field1" size="40"/>||!Input Text-index |<$edit-text tiddler="testdb" placeholder="Input text-index" index="field2" size="40" tag=input/>|\define db() $(currentTiddler)$-db
\define db() $(currentTiddler)$-db
|Title|Value|h|!Input Text-index |<$edit-text tiddler=<<db>> placeholder="Input text-index" index="it" size="40" tag=input/>||!First Name |<$edit-text tiddler=<<db>> index="firstname" placeholder="First Name" size="40"/>||!Date Field |<$edit-text tag=input type=date tiddler=<<db>> index="dt_text"/>||!URL Field |<$edit-text tag=input type=url tiddler=<<db>> placeholder="https://" index="dt_URI"/>||!Telephone Field |<$edit-text tag=input type=tel tiddler=<<db>> placeholder="+4407706811884" index="tel"/>||!Email Field |<$edit-text tag=input type=email tiddler=<<db>> placeholder="ad...@admin.com" index="email"/>||!Colour Field |<$edit-text tag=input type=color tiddler=<<db>> placeholder=color index="color"/>|