I have a few forms I'm using that have basic text boxes where you can enter
a string of text and the form saves the string somewhere. If I have the
text box store its contents in a field in the containing tiddler, I have to
type the string I want to input one character at a time, as any change in
the fields of the tiddler causes the screen to de-focus from the text box.
The only workaround I've found so far is to store the string in a temp
tiddler:
<$edit-text tiddler="$:/temp/genericname" tag="input" default="name"/>
This works fine in most situations. Here is one where it does not.
I have a form where I can quickly and easily add a tiddler for a character
(person, not text). One of the fields in this form is the character's
name. What I'm trying to do is make the form show a button that would
allow me to add the new character tiddler if said tiddler doesn't exist,
and the string "Already Exists" if it does, but not both at the same time.
This prevents me from accidentally overwriting an existing character if I
put a name that's already been used. It's close to working, but I have a
major problem.
Let's say I made a character named John Doe using the form, and he didn't
exist before I used the form. Let's also say I have a character named Jane
Doe already made. At the moment, the form has the name John Doe in its
name input and, since John Doe didn't exist before-hand, the button
allowing me to add him is visible. If I change the name to Jane Doe, the
button isn't updated and, if pressed, overwrites Jane Doe.
I think the problem is that the form isn't updating the containing tiddler
when I type a string into the name input. I say this because the form has
two selection boxes that modify fields in the containing tiddler, and when
those are modified, the button updates correctly.
*I think what I need is a way to update a field in the containing tiddler
using a text box that doesn't require me typing the input
character-by-character.* If I can find that, this problem should be fixed.
Here's the relevant code:
Name: <$edit-text tiddler="$:/temp/genericname" tag="input" default="name"
/>
<$setvars _moo="<<single_image " _fish=">>" _chirp={{!!image}} blah="moo
chirp fish">
<$set name=thebutton value='
<$button> Add Character
<$action-setfield $tiddler="Template: Generic Character"
title={{$:/temp/genericname}}/>
<$action-setfield $tiddler={{$:/temp/genericname}} text=<<blah>>/>
</$button>'>
<$set name=addifsafe
filter="[prefix{$:/temp/genericname}suffix{$:/temp/genericname}tag[character]]"
value="Already Exists" emptyValue=<<thebutton>>>
<<addifsafe>>
</$set>
</$set>
</$setvars>
The image field that's used in the setvars widget is set using a selection
box. It works fine.
The first set widget sets the value of a variable named thebutton to code
that makes a button. This part works fine.
The second set widget that sets addifsafe is the problem.
Doing both prefix and suffix was the only workaround I found to get a
tiddler with a specific title without returning a link to a missing tiddler
if said title wasn't found (this is what title[] and putting the tiddler
name in directly seem to do). If there's a better way to do this, please
let me know.
Since the prefix and suffix parameters both use the temp tiddler, rather
than a field in the containing tiddler, the second set widget doesn't get
updated when the name text-box does. This creates the aforementioned
problem.
Does anyone have any ideas on how to fix this?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/8c19ee43-cb44-4a52-b1ba-d15d1b122d7a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.