DynaPDF.SetTextFieldValue
-------------------------

The function sets or changes the value and default value of a text field.

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

MBS( "DynaPDF.SetTextFieldValue"; PDF; Field { ; Value; DefValue; Align } ) 

**MBS**( **"DynaPDF.SetTextFieldValue";** /\* The function sets or changes the value and default value of a text field. \*/  
**$PDF**; /\* The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). \*/   
**$Field**; /\* The field index or field name.e.g. "FirstName" \*/   
**$Value**; /\* Optional; The new text field value.e.g. "Andreas" \*/   
**$DefValue**; /\* Optional; The new default text field value.e.g. "" \*/   
**$Align**) /\* Optional; The text alignment. Can be Left, Center, Right or Justify.e.g. "Justify" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PDF | The PDF reference returned from [DynaPDF.New](DynaPDFNew.md). | $pdf |  |
| Field | The field index or field name. | "FirstName" |  |
| Value | The new text field value. | "Andreas" | Optional |
| DefValue | The new default text field value. | "" | Optional |
| Align | The text alignment. Can be Left, Center, Right or Justify. | "Justify" | Optional |

### Result

Returns OK or error.

### Description

The function sets or changes the value and default value of a text field.   
The parameters Value and DefValue can both be empty, if both values should be deleted. The parameter DefValue defines the default value of the field, this value is shown in Adobe's Acrobat as long as the field has no value; it will be hidden when entering the field.  
The strings are drawn with the font that is associated with the field. The font size is taken from the field settings. If set to "auto", the font size is computed from the field's bounding box.  
See also [SetTextFieldValue](https://www.monkeybreadsoftware.com/DynaPDF-Manual/SetTextFieldValue.shtml) function in DynaPDF manual.

### Examples

Sets text field value:

 MBS ( "DynaPDF.SetTextFieldValue"; $PDF ; "FirstName"; "Geoff"; ""; "Left" )  
### See also

- [DynaPDF.AddActionToObj](DynaPDFAddActionToObj.md)
- [DynaPDF.CreateJSAction](DynaPDFCreateJSAction.md)
- [DynaPDF.FlattenAnnotOrField](DynaPDFFlattenAnnotOrField.md)
- [DynaPDF.GetPageField](DynaPDFGetPageField.md)
- [DynaPDF.GetTextFieldValue](DynaPDFGetTextFieldValue.md)
- [DynaPDF.New](DynaPDFNew.md)
- [DynaPDF.SetFieldExpValue](DynaPDFSetFieldExpValue.md)
- [DynaPDF.SetFieldFont](DynaPDFSetFieldFont.md)
- [DynaPDF.SetNumberFormat](DynaPDFSetNumberFormat.md)
- [DynaPDF.SetTextFieldValueEx](DynaPDFSetTextFieldValueEx.md)

### Example Databases

- [DynaPDF/Create Form](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Create%20Form.shtml#2ScriptAnchor_)
- [DynaPDF/Create PDF with sum form field](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Create%20PDF%20with%20sum%20form%20field.shtml#2ScriptAnchor_)
- [DynaPDF/Fill Form Fields](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Fill%20Form%20Fields.shtml#1ScriptAnchor_)
- [DynaPDF/Form/Form](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/DynaPDF/Form/Form.shtml#4ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Advent calendar - Door 6 - Sending Out Wishlist Forms](https://www.mbsplugins.de/archive/2024-12-06/MBS_FileMaker_Advent_calendar_/monkeybreadsoftware_blog_filemaker)
- [Unlocking the Power of PDFs in FileMaker with DynaPDF and the MBS FileMaker Plugin](https://www.mbsplugins.de/archive/2024-09-16/Unlocking_the_Power_of_PDFs_in/monkeybreadsoftware_blog_filemaker)
- [PDF Forms with MBS Plugin](https://www.mbsplugins.de/archive/2018-04-21/PDF_Forms_with_MBS_Plugin/monkeybreadsoftware_blog_filemaker)
- [Tip of the day: DynaPDF form creation with calculation with FileMaker](https://www.mbsplugins.de/archive/2016-08-24/Tip_of_the_day_DynaPDF_form_cr/monkeybreadsoftware_blog_filemaker)
- [MBS Filemaker Plugin, version 4.1pr4](https://www.mbsplugins.de/archive/2014-03-09/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 1/2022, Seite 21](https://filemaker-magazin.de/neuigkeit/4172-Appetithappen-FMM_202201)

This function checks for a license.

Created 18th August 2014 , last changed 27th January 2023

  
[DynaPDF.SetTextDrawMode](DynaPDFSetTextDrawMode.md) - [DynaPDF.SetTextFieldValueEx](DynaPDFSetTextFieldValueEx.md)

[HTML Version](DynaPDFSetTextFieldValue.shtml)