NotAllowedError: removeField action on button mouse-up
Is this.removeField or something else in the below script a trusted function?
I'm trying to create a button that will delete fields by type. I want the button to delete buttons, checkboxes, and radio buttons.
I already have this as an action and it works, but I'd like it as a button for easy access and for other users to use.
I'm getting the following error: NotAllowedError: Security settings prevent access to this property or method. Doc.removeField:11:AcroForm:MouseUp:Action1
Below is the script I've modified from another forum, but can't seem to find the link to reference. The only difference is I added the or operand to find multiple field types. It's set to a mouse-up event. I've also tried putting most of it document level except for the last for condition and the delete button action., but that still produces the error. Additionally, I tried this.removeField with a named field and it works. I guess I'm not seeing anything that would require a trusted function...
//Remove Buttons and Checkboxes
var fields = new Array();
for ( var i=0; i<this.numFields; i++)
{
var fname = this.getNthFieldName(i);
if ((this.getField(fname).type == "button" || this.getField(fname).type == "checkbox" || this.getField(fname).type == "radiobutton"))
{
fields.push(fname);
}
}for (var i=0; i<fields.length; i++)
{
this.removeField(fields);
}
