Tiddler with a form that creates a new Tiddler based on form contents

As the title suggests, I have been looking for a way to have a Tiddler that has a form in it with a few text boxes. When I click the button, it would create a Tiddler with the text in the text boxes in the new Tiddler.

Example:

Title:
Client:
Notes:
Solution:

Any suggestions would be greatly appreciated.

Here’s one example of a solution that works as you describe. I assume you’d be wanting to use fields to hold client, notes, and solution. Then you’d use a template to display results from those fields, as desired…

(You have do dismiss some alerts that pop up at the beginning; they don’t affect the content of the form-input process.)

Edit the New Budget Input Form to see how the edit-text widgets and action buttons work.

Feel free to follow up if you get stuck!

-Springer

2 Likes

This is getting me on the right track, thank you!

It seems for this one though, it doesn’t include the input fields in the final Tiddler. I’m trying to have the output also include the input fields in the body of the text so I can easily go back and read it.

So the final product would look like

Title: text here
Client: text here
etc…

Also, is there a way to automatically add a tag to the new Tiddler?

Thanks so much for your time!

See also maths/ physics text book in the showcase section here.

It has a form to fill in and then a button to make a tiddler.

to show a field’s value in its body text, you can reference it like this: {{!!fieldname}}

so instead of having the text field be filled by the form (like in the example) set it (using triple double quotes so you can use newlines) like this:

<$action-createtiddler (... define other fields etc...) text="""
Title: {{!!title}}
Client: {{!!client}}
(...add more here...)
""" ></$action-createtiddler>

you can add a tag by defining the tags field in the same action-createtiddler widget:
tags="tagNameHere otherTag" the same way you’re defining the other fields :slight_smile:

Following up on @Scribs idea:

Having the tiddler created so that the text-field is populated this way certainly works, and gives you a good feel for how easy it is to display fields.

If you want to be maximally flexible moving forward, then you might want to make a template that uniformly displays your fields in a particular chosen way.

You would make a template tiddler called ProjectTemplate (or whatever you like) with the contents:

Title: {{!!title}}
Client: {{!!client}}
[...add more here...]

If you modify the <$action-createtiddler> widget, so that each new tiddler’s text field is set to {{||ProjectTemplate}} … then the resulting tiddler will “transclude” the information in its fields, according to the template’s instructions, making it look the same, in view mode, as packing all that content into the text field each time.

Why put extra time into setting it up this way? It’s slightly more efficient in the long run. But also:

Suppose you realize you need to edit or add complexity to how these tiddlers look (Let’s show client names with yellow highlighting! Let’s put the title in bold…, and let’s also display the date the project was created, with a horizontal rule underneath all those headers… Oh geez, the yellow highlighting is too tacky, scratch that… but let’s include the company logo floating off to the right…)…

No problem! Then you just change the template once, and any tiddler set up this way (displaying field data according to this template) will instantly reflect your new preferences about how to display the details. Moving forward, you can experiment with different patterns, without having to go back and edit every project tiddler’s content to reflect your new choice.

There’s one more suggestion waiting in the wings, about applying such templates automatically (without even having to put {{||ProjectTemplate}} in the text field)… but I think that’s less important than getting a feel for how transclusion with templates can give HUGE powers to TiddlyWiki.

1 Like

As a rule try and not put anything in the text field of your “instance tiddlers” (eg instance of a contact", other than unique content. Both during creation use a template and a template in its display. ie a view template.

Choose a field to drive which template to display a given tiddler, I use the object-type field and give it a value eg todo, contact, template and more. I always set this when creating a tiddler.

  • Then a view template tiddler will test for the object-type field and use a display template for each object-type.
  • You can also use the cascade mechanisium