Hi Tobias.
One thing that might be impacting you is that the number of nodes you have will change after you call remove so you might be running into problems there...
A way to solve this would be to add a "break;" after you remove the param to exit your loop.
<abs contexttype="opengear" style="">
<meta>
<params>
<param access="1" maxlength="0" name="My Param" oid="params.myparam" precision="0" type="STRING_ARRAY" value="a;b;c;d;e;f;g;h;i" widget="default">
<value>a</value>
<value>b</value>
<value>c</value>
<value>d</value>
<value>e</value>
<value>f</value>
<value>g</value>
<value>h</value>
<value>i</value>
</param>
<param access="1" constrainttype="STRING_CHOICE" name="Table" oid="params.table" precision="0" type="INT16" value="-1" widget="table">
<constraint>params.myparam</constraint>
</param>
</params>
</meta>
<param expand="true" height="486" left="18" oid="params.table" showlabel="false" top="33" width="395"/>
<button buttontype="push" height="99" left="426" name="Remove G" top="33" width="211">
<task tasktype="ogscript">var elemCount = params.getElementCount('params.myparam');
for (var i = 0; i < elemCount; i++)
{
var param = params.getParam('params.myparam', i);
if (param.getValue() == 'g')
{
param.remove();
break;
}
}</task>
</button>
</abs>
Another option would be to use params.setAllValues. This would work if you are trying to remove multiple values or don't want to exit your loop until the end for some other reason:
<button buttontype="push" height="99" left="426" name="Remove E" top="140" width="211">
<task tasktype="ogscript">var elemCount = params.getElementCount('params.myparam');
var newValues = [];
for (var i = 0; i < elemCount; i++)
{
var paramValue = params.getValue('params.myparam', i);
if (paramValue != 'e')
{
newValues.push(paramValue);
}
}
params.setAllValues('params.myparam', newValues);</task>
</button>