I need to update all fields in a document to be not required. I read the value but cannot set it. I get the following error in the debugger.
NotAllowedError: Security settings prevent access to this property or method.
Field.required:10:click undefined:Exec
According to the documentation, this should be easy to do.
--------------------------------------
required
Sets or gets the required characteristic of a field. When true, the fields value must be nonnull when the user clicks a submit button that causes the value of the field to be posted. If the field value is null, the user receives a warning message and the submit does not
occur.
Type: Boolean Access: R/W Fields: all except button.
Example
Make "myField" into a required field.
var f = this.getField("myField");
f.required = true;
--------------------------------------
I am not sure what this means or how to correct. Any help would be greatly appreciated. My code is below.
var fieldCount = event.target.numFields;
for ( var i = 0; i < fieldCount; i++)
{
var fieldName = event.target.getNthFieldName(i);
app.alert(fieldName);
var field = event.target.getField(fieldName);
if(field.type != "button" &&
field.type != "checkbox")
{
app.alert(field.required);
field.required = false;
}
}