Also, you can add a task to a parameter. When it changes, it triggers that task.
Double click on the parameter in your panel, You should have an "Add" button at the bottom of the page to add new tasks:

It's in that task that you should add your rename methods

Here is the whole panel:
<abs contexttype="opengear" id="_top" keepalive="false" style="">
<meta>
<params>
<param access="1" maxlength="0" name="test" oid="test" type="STRING" value="type new name" widget="default"/>
</params>
</meta>
<button buttontype="push" height="87" id="myButton" left="90" top="206" width="159">
<task tasktype="ogscript">
/*! block id=1000 !*/
ogscript.rename("_top", "");
/*!!
<block id="1000" type="ogscript_rename" x="275" y="102" w="243" ID="_top" NAME="" />
!!*/
/*!!<checksum>31fa961ba2215c095e9ed211b0ff137e</checksum>!!*/</task>
</button>
<param expand="true" height="59" left="136" oid="test" showlabel="false" top="366" width="286">
<task tasktype="ogscript">
/*! block id=1001,1002 !*/
ogscript.rename("myButton", params.getValue('test', 0));
/*!!
<block id="1001" type="ogscript_rename" x="450" y="153" w="243" ID="myButton" NAME="ID:1002" />
<block id="1002" type="param__top&amp;test (test)[0]" x="92" y="206" w="243" SET="" />
!!*/
/*!!<checksum>726f563f1e23272b18ee7e16f2a7f237</checksum>!!*/</task>
</param>
</abs>
#DashBoard