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 : \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> This will display like so: The main thing to notice is if you want to create a new field in an existing form, you need to use following macro call with new parameters: <<ToggleEditFld form2 input url dt_url "Enter [[Sometext|http://www.google.com]] to display Sometext as hyperlink for URL: https://www.google.com">> or <$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" /> The second option is better as that explains the parameters better and can allow passing the formname as a variable if it is a big form with lot of fields. On Friday, 3 July 2020 13:54:39 UTC+1, Jake wrote: > > > > >> 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 >> <https://tiddlywiki.com/prerelease/#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 >> <https://tiddlywiki.com/prerelease/#CheckboxWidget>to toggle that tag. >> >> > Yeah, thanks Mat! That works. I dunno how I missed that. > > <$button set="$:/state/DataReveal" setTo="show">Data Input</$button> > <$button set="$:/state/DataReveal" setTo="hide">Hide</$button> > > <$reveal type="match" state="$:/state/DataReveal" text="show"> > > {{||DataInput}} > > </$reveal> > > It even works within a macro. At first had some troubles because of double > nested transclution. Changed of of the transclutions into macro and all > went nicely. > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/94644987-027b-43db-84aa-a0651e86ae26o%40googlegroups.com.