DynaPDF.SetFieldName
--------------------

Changes the name of an interactive form field.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [DynaPDF](component_DynaPDF.md) | [4.0](newinversion40.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "DynaPDF.SetFieldName"; PDF; Field; NewName ) 

**MBS**( **"DynaPDF.SetFieldName";** /\* Changes the name of an interactive form field. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Field**; /\* The field index or field name.e.g. "FirstName" \*/   
**$NewName**) /\* The new name for the field.e.g. "LastName" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |
| Field | The field index or field name. | "FirstName" |
| NewName | The new name for the field. | "LastName" |

### Result

Returns OK or error.

### Description

Changes the name of an interactive form field.   
Field names must sometimes be changed when multiple interactive forms with identical field names are imported. The resulting form will be damaged if the names of such fields are not changed.  
The function SetFieldName() does not check whether a field name is already in use by another field. Such a checking would not be useful, because the usage of the function would be much more complicated. Use the function [DynaPDF.CheckFieldNames](DynaPDFCheckFieldNames.md) to check the integrity of the form after field names were changed.  
Changing of field names can cause problems if the field was used in JavaScript action or global JavaScript. The JavaScript(s) must also be changed to avoid error messages in Adobe's Acrobat. Global JavaScripts can be accessed with the function [DynaPDF.GetJavaScript](DynaPDFGetJavaScript.md) and changed with the function [DynaPDF.ChangeJavaScript](DynaPDFChangeJavaScript.md). A JavaScript Action can be accessed with the function [DynaPDF.GetJavaScriptAction](DynaPDFGetJavaScriptAction.md) and changed with the function [DynaPDF.ChangeJavaScriptAction](DynaPDFChangeJavaScriptAction.md).  
See also [SetFieldName](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetFieldName.shtml) function in DynaPDF manual.

### See also

- [DynaPDF.CheckFieldNames](DynaPDFCheckFieldNames.md)
- [DynaPDF.GetFieldMapName](DynaPDFGetFieldMapName.md)
- [DynaPDF.GetFieldName](DynaPDFGetFieldName.md)
- [DynaPDF.GetFieldType](DynaPDFGetFieldType.md)
- [DynaPDF.GetJavaScript](DynaPDFGetJavaScript.md)
- [DynaPDF.GetJavaScriptAction](DynaPDFGetJavaScriptAction.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetFieldColor](DynaPDFSetFieldColor.md)
- [DynaPDF.SetFieldFlags](DynaPDFSetFieldFlags.md)
- [DynaPDF.SetFieldMapName](DynaPDFSetFieldMapName.md)

### Release notes

- **Version 11.2**
    - Fixed [DynaPDF.SetFieldName](https://www.mbsplugins.eu/DynaPDFSetFieldName.shtml) to allow to specify field to rename by name.

### Blog Entries

- [MBS FileMaker Plugin, version 11.2pr1](https://www.mbsplugins.de/archive/2021-04-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 18th August 2014 , last changed 18th August 2014

  
[DynaPDF.SetFieldMapName](DynaPDFSetFieldMapName.md) - [DynaPDF.SetFieldOrientation](DynaPDFSetFieldOrientation.md)

[HTML Version](DynaPDFSetFieldName.shtml)