popup of tiddler with <<formTiddler>> missing contents

39 views
Skip to first unread message

Dave Parker

unread,
May 22, 2009, 4:36:07 PM5/22/09
to TiddlyWiki
Hi,

I have a tiddler with a nested slider popup like this

+++^* <<tiddler Problem1>> ===


and the tiddler called "Problem1" has this in it:

<<formTiddler ProblemTemplate>><data>{"location":"sdfgsdfg","referral
to":"elbow","course":"better"}</data>

When I click the slider to show the pop-up, the little box around the
pop-up only borders part of the tiddler, and the field boxes extend
beyond the right border and are empty. When I open the tiddler
normally it is fine.


Any ideas?

Thanks,
DP

Eric Shulman

unread,
May 22, 2009, 5:56:53 PM5/22/09
to TiddlyWiki
> +++^* <<tiddler Problem1>> ===
> When I click the slider to show the pop-up, the little box around the
> pop-up only borders part of the tiddler, and the field boxes extend
> beyond the right border and are empty.  When I open the tiddler
> normally it is fine.

Try specifying a fixed width for the floating slider panel:

+++^40em^* <<tiddler Problem1>> ===

-e

cmari

unread,
May 22, 2009, 9:59:16 PM5/22/09
to TiddlyWiki
The slider isn't really the issue. The problem is that data in a form
tiddler does not appear in transclusion (e.g., when using the
<<tiddler>> macro) - all you can see is the outline of the form, not
the contents of the form fields. The only way I've been able to make
the <<tiddler>> macro display the contents of forms is by adding
another macro inside the form tiddler like <<showData>> or a fET macro
that calls up the data and puts it into a table (inside the form
tiddler itself, so that the data is effectively displayed twice in
that tiddler - though it can be hidden in a slider). I'd be
interested to hear about other solutions!
cmari

Eric Shulman

unread,
May 23, 2009, 12:23:33 AM5/23/09
to TiddlyWiki
> The slider isn't really the issue. The problem is that data in a form
> tiddler does not appear in transclusion (e.g., when using the
> <<tiddler>> macro) - all you can see is the outline of the form, not
> the contents of the form fields.

The problem originates with the 'lookup function' that
[[FormTiddlerPlugin]] is using to identify the tiddler in which the
<<formTiddler>> macro and <data>...</data> block are stored (the
"source" tiddler).

Here's what that function currently looks like:
------------------------------------------
config.macros.formTiddler.getContainingTiddlerName = function(element)
{
return story.findContainingTiddler(element).id.substr(7);
}
------------------------------------------

Unfortunately, story.findContainingTiddler() (a standard TW core
function) always returns the title of the *outermost* containing
tiddler -- in this case, the one that invokes the <<tiddler>> macro --
rather than name the actual source tiddler that was transcluded when
that macro was processed. This, of course, produces the results that
you have observed: the plugin is unable to retrieve the form data,
because it is looking in the wrong tiddler!

Fortunately, there may be a relatively easy solution...

The key is to know that, whenever a tiddler is displayed in the story
column, it is contained within a 'wrapper' element that includes a
special "tiddler" attribute that holds the title of the current
tiddler.

Similarly, whenever a <<tiddler>> macro is processed, the transcluded
content is also contained in a wrapper element that has its own
"tiddler" attribute, set to the title of the source tiddler that was
transcluded.

The fix involves re-defining the FormTiddlerPlugin lookup function, so
that it will find the *innermost* wrapper that has a "tiddler"
attribute, and then use *that* value to retrieve the correct
<data>...</data> block.

We can do this by adding an extra tiddler, e.g.,
[[FormTiddlerPluginTweak]], tagged with 'systemConfig', with the
following replacement code:
------------------------------------------
config.macros.formTiddler.getContainingTiddlerName = function(e) {
// find transcluded OR containing tiddler
while(e && !e.getAttribute("tiddler")) e=e.parentNode;
return e?e.getAttribute("tiddler"):e;
};
------------------------------------------

PLUS: as an added bonus, because 'transclusion' via the <<tabs>> macro
works the same way as the <<tiddler>> macro (i.e., it sets the
"tiddler" attribute of the containing wrapper), this 'tweak' should
also fix the same problem when using forms from within tabs!

Give it a try and let me know what happens...

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Dave Parker

unread,
May 23, 2009, 12:57:41 AM5/23/09
to TiddlyWiki
I think you're on to something...

the fix does work for viewing the form tiddler in the pop-up, but it
disables the viewing of the form tiddler in the straight "right from
the tiddler" way...

Any ideas? (he said hopefully :-)

Thanks,
Dave

cmari

unread,
May 23, 2009, 9:24:49 AM5/23/09
to TiddlyWiki
This is really neat, especially because it's then possible to make
changes to a form while it's being viewed in transclusion!
But as Dave says, the refresh doesn't quite keep up - whenever either
the original tiddler or the transclusion tiddler is changed, the other
tiddler has to be closed and reopened in order to display the change.

Am I correct that the "wrapper" is also the reason why, even with this
tweak installed, my form <data> that is inside <part></part> still
doesn't display?
cmari

Dave Parker

unread,
May 27, 2009, 8:58:20 PM5/27/09
to TiddlyWiki
Okay, I've tried something different to try to get this idea to work:
I was wondering if I could do the same thing with custom fields
instead of FormTiddler data, so I learned how to use custom fields and
"hide when". Unfortunately I forgot that the custom fields don't
display inside the main tiddler body. Is there a way to get a custom
field to show up with a <<tiddler TiddlerName>>?

Dave
> > > TiddlyTools / ELS Design Studios- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages