Can anyone please provide some help for a solution to this request.
I have a number of tiddlers named $:/fieldtemplates-xxx
These templates contain form entries for fields
I would like to use a tiddler with checkboxes to select a required entry and transclude its contents (text field) into the current tiddler " Form Entries transclude" in order to create a form template.
I have a tiddlyhost wiki with the relevant tiddlers here to show my attempt so far.
How can I modify my tiddlers to get the required output?
This is a rough and ready version, which you can play with to make it look as you need:
<table>
<$list filter="[tag[form-entry]sort[title]]" variable="form-template" ><tr><td><$checkbox field=<<form-template>> checked=<<form-template>> unchecked="" default="unchecked"> <<form-template>> </$checkbox></td><td><$transclude $tiddler={{{ [<currentTiddler>get<form-template>] }}}/></td></tr></$list>
</table>
You can also modify to show the caption (which isn’t currently defined for one of your templates), or what’s sandwiched between <label>
…</label>
tags:
<table>
<$list filter="[tag[form-entry]sort[title]]" variable="form-template" ><tr><td><$checkbox field=<<form-template>> checked=<<form-template>> unchecked="" default="unchecked"> {{{ [<form-template>get[text]split[label>]nth[2]removesuffix[</]] :else[get[title]split[-]last[]] }}} </$checkbox></td><td><$transclude $tiddler={{{ [<currentTiddler>get<form-template>] }}}/></td></tr></$list>
</table>
No doubt this can be more streamlined, less redundant. Just hoping to give you a quick glimpse for now…
Thank you @Springer for your quick reply. It does transclude the form entries as I requested. Great work.
One thing though, when I tried to create the template / tiddler it seems to also add the fields that are checked to the tiddler which I wouldn’t need.
Can this be changed to create the tiddler or a new tiddler with just the resultant checked field content
Well, which fields to show has to be stored somewhere, if you want different tiddlers to show different fields, and if you want to be able to continue to make modifications. The checkboxes make sense if you want to continue to have access to whether or not the different drop-down templates show, on a per-tiddler basis.
If you want the ability to display any number of the boxes, but do not need the differences to be tracked differently across tiddlers, then have the checkboxes write their state to a temp tiddler… like this:
<table>
<$list filter="[tag[form-entry]sort[title]]" variable="form-template" ><tr><td><$checkbox field=<<form-template>> tiddler="$:/temp/templates" checked=<<form-template>> unchecked="" default="unchecked"> <$text text={{{ [<form-template>get[caption]] :else[<form-template>get[text]split[label>]nth[2]removesuffix[</]] }}}/> </$checkbox></td><td><$transclude $tiddler={{{ [[$:/temp/templates]get<form-template>] }}}/></td></tr></$list>
</table>
You may also want to check out documentation on placeholder cues. The difficulty with default values in the system you’ve got there is that someone may think that they don’t have to do anything to affirm “Monday” if it’s showing up as the default value, and it’s in fact the value they want.
Here’s how you can set up “years” so that people who see the dropdown won’t be confused about how the dropdown works:
<label>Year</label>
<$select field=year default="Choose a year">
<option disabled>Choose a year</option>
<$list filter="[enlist{lookups!!years}]" >
<option>{{!!title}}</option>
</$list>
</$select> <br/>
@Springer Thanks again for your speedy reply. I will need to give this some more thought but what you have provided has been a great help.
I am hoping to use a number of these fieldtemplates with a check on demand to create required tiddlers. Further tagging may narrow down the selections for various forms to be created such as Contact Forms, DVD Forms, etc
Thanks for the links to the documentation on placeholder cues and the dropdown example.
Sorry but I am pushed for time just now, I will reply later when I have worked on this some more.
Thanks Again for your help
Hello @Springer,
sorry I had to run off yesterday, but I’ve managed to update my form with a button to clear the temp/templates.
My problem now is how to create a new tiddler from the form before clearing the temp stuff (I hope that I can use a number of common $:/fieldtemplate tiddlers across a variety of forms so as to limit the amount of ViewTemplates required)
Would you please tell me how to edit the " Form Tiddler Example" to achieve this.
My Wiki
Hey,
I second this wish…the preselection fields before creating the tiddler is essential for Child based semantic Order of the tiddlers…
I decided to just create a Buttons, New Book and New DVD tiddler to save entries as I did not know any other way to save the form data. Please use any method that you prefer for now.
If I learn how to do it by another method, I’ll update the site.
My thanks to @Springer for his invaluable help and you @Cyrill_Andreani for your interest and feedback.