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 On May 22, 11:57 pm, Dave Parker <cedar...@telus.net> wrote: > 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 > > On May 22, 10:23 pm, Eric Shulman <elsdes...@gmail.com> wrote: > > > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To post to this group, send email to TiddlyWiki@googlegroups.com To unsubscribe from this group, send email to tiddlywiki+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/TiddlyWiki?hl=en -~----------~----~----~----~------~----~------~--~---