FormFieldValueFormat Class
Allows you to specify format for form field values.
Namespace: DevExpress.Docs.Pdf
Assembly: DevExpress.Docs.Pdf.v26.1.dll
NuGet Package: DevExpress.Docs.Pdf
Declaration
Related API Members
The following members return FormFieldValueFormat objects:
Remarks
You can specify value format for the following form fields:
Use the TextBoxField.ValueFormat or ComboBoxField.ValueFormat property to access a FormFieldValueFormat object.
You can specify the date and time, numeric, percentage, and special value format. Use the following properties to specify the JavaScript code used to specify the value format:
Note
Scripts are in effect for PDF viewers that support JavaScript. For JS API reference, use JavaScript for Acrobat API Reference.
Example
How to: Specify a Value Format for a Form Field
The following code snippet executes a script that allows you to enter only numbers in the “x-x-x” format:

using DevExpress.Docs.Pdf;
TextBoxField textField = new("TextField");
pdfDocument.Fields.Add(textField);
textField.ValueFormat = new FormFieldValueFormat {
FormatScript = "if (event.value != \"\") {" +
"var value = event.value; " +
"event.value = \"\"; " +
"for(var i = 0; i<value.length - 1; i++)" +
" event.value += value.charAt(i) + \"-\";" +
"event.value += value.charAt(value.length - 1);}",
KeystrokeScript = "var re = /^[0-9]+$/;" +
"if (event.value != \"\") {" +
" event.rc = re.test(event.value);" +
"}"
};