Using message catcher to set a fieldname's value to a list item

Hi, I am trying to use a message catcher (or anything) wrapped around a list to set a fieldname to the value selected from the list;

the following is extracted snipits

\define set-fieldvalue-actions()
<$action-setfield $field=<<fieldname>> $value=<<selected-value>>/>
\end
...
<$messagecatcher $tm-navigate=<<set-fieldvalue-actions>> >
<$list filter="[<fieldvalues>enlist-input[]]" variable=selected-value>

</$list>
</$messagecatcher>
...

Can anyone tell me how to make this work?

Try this:

\define set-fieldvalue-actions()
<$action-setfield $field=<<fieldname>> $value=<<event-navigateTo>>/>
\end

<$let fieldname="test" fieldvalues="A B C D E">
<$messagecatcher $tm-navigate=<<set-fieldvalue-actions>> >
<$list filter="[<fieldvalues>enlist-input[]]">
   <div><$link/></div>
</$list>
</$messagecatcher>

test={{!!test}}

Thanks @EricShulman, your example works in isolation, but is not working in my application of it, which is a bit of a mystery.

  • Despite being moments away from completing this solution I may need to revisit later.

I have it working when the macro is called directly but when trying to get it into $:/core/ui/EditTemplate/fields add new fields section it fails.

Thanks for your help, at least I know that part is working now.