Hi Eric, I'm still not having much success with this. Would you mind having a look at my experimental code <https://tiddlytest.github.io/#Playing%20with%20Eric%27s%20combobox%20and%20the%20%22okaction%22%20param> again, and telling me where I'm going wrong? I have your new *<<myaction>>* macro (I haven't even bothered renaming it yet) at the top of that tiddler, and I've specified *{{!!city}}* as the field which I want to be saving from. I've tried both a *<<combobox>>* invocation and a *<$macrocall>* widget, but I just can't seem to get it to work. The *<<combobox>>* seems to break something whenever I use...
clickaction:"""<<myaction>>""" Also, I'm a little concerned about using the *clickaction* parameter for this. I had intended to use the *clickaction* param for something else, such as to modify the options of a subsequent *<<combobox>>* based on the selection from the current one. If I'm already using *clickaction* to set the value to be a specific field, will that preclude me from using it for other purposes as well? Or, will those other purposes just end up getting appended to the *<<myaction>>* macro? Kind regards, Hegart. On Friday, 8 April 2016 04:33:26 UTC+12, Eric Shulman wrote: > > On Thursday, April 7, 2016 at 8:18:59 AM UTC-7, Hegart Dmishiv wrote: >> >> I'm making a start on that idea of cascading the selection from one >> *<<combobox>>* into the filter for the options of another. However, in >> the second example on this experiment tiddler >> <https://tiddlytest.github.io/#Playing%20with%20Eric%27s%20combobox%20and%20the%20%22okaction%22%20param>, >> >> I'm stuck with a bit of a problem. Despite having specified field:"city" >> as the field from which the *option value* should be stored, it still >> seems to be storing the *title* of the selected option, rather than the >> *city*. The *option labels* are being populated properly, using your >> example above of template:"{{!!city}}", but the *option values* aren't >> respecting the field: parameter. >> > > The built-in (hardcoded) combobox list "click" handler performs this > action: > <$action-setfield $tiddler="""$tiddler$""" $field="""$field$""" > $index="""$index$""" $value=<<currentTiddler>>/> > i.e., when you click a list item, it sets the target field (or index) to > the <<currentTiddler>> value (which is the title of the selected tiddler). > > To set a different value when an item is clicked, you can specify a custom > "clickaction" param in the macro call so that after the current title value > is set, you can overwrite it with the value from the desired field instead. > > First, to avoid nested use of """, define the click action as a separate > macro: > > \define myaction() > <$action-setfield $tiddler="""$tiddler$""" $field="""$field$""" > $index="""$index$""" $value={{!!fieldname}}/> > \end > > Note that this macro is performing the same handling as the built-in click > handler, but sets the value from a specified field, rather than using > <<currentTiddler>>. > > Then, to use this "action macro", add this param to your combobox macro > call: > clickaction:"""<<myaction>>""" > > Note the use of the tripled-quotes so that the call to <<myaction>> is NOT > parsed, but is simply passed as literal text that is inserted into the > combobox code and only invoked when an item is actually clicked upon. > > let me know how is goes... > > enjoy, > -e > -- 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 tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. 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/8072a764-23c0-4580-9fb4-4fc397d57525%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.