# Problem with a button operation

Hello everyone.
I’m trying to adapt a macro I found on a wiki to suit my needs but I can’t get it to work. It is a button that creates a tiddler with some predefined fields.
The button code is:

<$button actions={{$:/xp/ui/Actions/new-people}} tooltip="Create a new people" aria-label="new people" class="tc-btn-invisible tc-btn-mini">
<span class="tc-btn-icon">{{$:/core/images/new-button}}</span> new people </$button>&emsp;<small class="tc-sidebar-header">(<i><$count filter='[tag<aggregationTag>!has[draft.of]]'/> tiddlers</i>)</small>&emsp;<$button to="$:/people-help" tooltip="PEOPLE Help" class="tc-btn-invisible tc-btn-mini"> <span class="tc-btn-icon">{{$:/core/images/help}}</span>
</$button> </div>  The content of the tiddler$:/xp/ui/Actions/new-people that I replace with mine is as follows:

\define get-tags() $(textFieldTags)$
\define get-text() $(textField)$
<$vars textFieldTags={{$:/config/new-people/Tags}} textField={{$:/config/new-people/Text}}> <$action-sendmessage $message="tm-new-tiddler" title=<<now "people-YYYY0MM0DD0hh0mm0ssXXX">> tags=<<get-tags>> text=<<get-text>> caption="a people" color="" description="" education="" lifetime="" image=""/> </$vars>


This is the model ($:/model/person-2) that I try to make the button execute but I can’t get it to do so: \define createNewItem() <$action-sendmessage
$message="tm-new-tiddler" title=<<unusedtitle """New$(new-item-title)$""">> tags="[[$(currentTiddler)$]]" foto="$:/plugins/kookma/thinkup/images/mr_avatar"
caption="name and title"
text=<<content>>
keywords=""
nombre=""
direccion=""
fecha_nac=""
telefono_f=""
/>
\end

\define content()

<$macrocall$name=image-pretty img={{!!foto}} align="right" caption={{!!caption}} tooltip={{!!caption}} alt=""/>

<table class="table-borderless source">
<tr><th>Nombre</th><td>{{!!nombre}}</td></tr>
<tr><th>Dirección</th><td>{{!!direccion}}</td></tr>
</table>

: <<.lorem>>

;Observaciones
: <<.lorem>>

\end


I’ve been doing several tests but I can’t get it to work. Can you tell me what I’m doing wrong, or what I have to change?

What I have done so far is change $:/xp/ui/Actions/new-people to $:/model/person-2, I have also tried to remove some parameters from the macro but it hasn’t worked…

You have imbalanced <div> here!

The $button works for me! What do you want to achieve? Hi Hohammad. Yes, when copying the button code I missed the </div>. The code that I use and that does not work for me is this: <$button actions={{$:/model/person-2}} tooltip="Create a new people" aria-label="new people" class="tc-btn-invisible tc-btn-mini"> <span class="tc-btn-icon">{{$:/core/images/new-button}}</span> new people
</$button>&emsp;<small class="tc-sidebar-header">(<i><$count filter='[tag<aggregationTag>!has[draft.of]]'/> tiddlers</i>)</small>&emsp;<$button to="$:/people-help" tooltip="PEOPLE Help" class="tc-btn-invisible tc-btn-mini">
<span class="tc-btn-icon">{{$:/core/images/help}}</span> </$button>


I’ve tried it on another wiki and it doesn’t work for me either. However if I change $:/model/person-2 to $:/xp/ui/Actions/new-people it works and I don’t know why.

Hello Juan,
I think in $:/model/person-2 you merely define two macros, but nowhere call the createNewItem macro. You could just call the $action-sendmessage directly without wrapping it in a macro. Your $:/model/person-2 then would look like this: \define content() <$macrocall name=image-pretty img={{!!foto}} align="right" caption={{!!caption}} tooltip={{!!caption}} alt=""/> <table class="table-borderless source"> <tr><th>Nombre</th><td>{{!!nombre}}</td></tr> <tr><th>Dirección</th><td>{{!!direccion}}</td></tr> <tr><th>Localidad</th><td>{{!!localidad}}</td></tr> </table> : <<.lorem>> ;Observaciones : <<.lorem>> \end <action-sendmessage
$message="tm-new-tiddler" title=<<unusedtitle """New$(new-item-title)$""">> tags="[[$(currentTiddler)$]]" foto="$:/plugins/kookma/thinkup/images/mr_avatar"
caption="name and title"
text=<<content>>
keywords=""
nombre=""
direccion=""

or adding a macro call <<createNewItem>> at the end of your version of $:/model/person-2 should also suffice to launch the action. You could also make the macros global by adding the $:/tags/Macro tag to $:/model/person-2 and change the button actions to actions="<<createNewItem>>". Have a nice day Yaisog See the @Yaisog answer above! As he said, $:/model/person-2  does nothing in your code.