Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

DynaPDF.SetNumberFormat

Limits textfield to only accept numbers.

Component Version macOS Windows Linux Server iOS SDK
DynaPDF 6.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "DynaPDF.SetNumberFormat"; PDF; Field; Sep; DecPlaces; NegStyle { ; CurrStr; Prepend } )   More

Parameters

Parameter Description Example Flags
PDF The PDF reference returned from DynaPDF.New. $pdf
Field The field index or field name. "FirstName"
Sep The decimal separator.
Can be CommaDot, NoneDot, DotComma or NoneComma.
"CommaDot"
DecPlaces Number of decimal places 2
NegStyle Negative number format.
Can be MinusBlack, Red, ParensBlack or ParensRed.
"ParensRed"
CurrStr The currency string.
Or empty for no currency.
"€" Optional
Prepend Position of Currency string.
Pass 1 to prepend or 0 to append.
0 Optional

Result

Returns OK or error.

Description

Limits textfield to only accept numbers.
The function restricts the allowed input characters of a text field to numbers and formats the resulting string as specified. A number format is represented as two separate JavaScript Actions in PDF which are automatically created and added to the text field by this function.
The same formats can also be applied manually by creating two JavaScript actions: one for the OnKeyStroke event, and one for the OnFormat event of the text field. See DynaPDF.AddActionToObj() for a description of the events.
DynaPDF uses the JavaScript functions AFDate_Keystroke() / AFDate_KeystrokeEx() or AFDate_Format() / AFDate_FormatEx() to apply a number or date format. The functions are described in the JavaScript scripting reference which is available at http://www.adobe.com.

See also SetNumberFormat function in DynaPDF manual.

Examples

Create field for numbers:

Set Variable [$f; Value:MBS("DynaPDF.CreateTextField"; $pdf; Create Form::Name; -1; Create Form::Multiline; Create Form::MaxLen; Create Form::PosX; Create Form::PosY; Create Form::Width; Create Form::Height)]
Set Variable [$r; Value:MBS("DynaPDF.SetTextFieldValue"; $pdf; $f; Create Form::Value; Create Form::DefaultValue)]
Set Variable [$r; Value:MBS("DynaPDF.SetNumberFormat"; $pdf; $f; "CommaDot"; 2; "Red"; "€"; 0)]

See also

Example Databases

Blog Entries

This function checks for a license.

Created 16th August 2016, last changed 16th August 2016


DynaPDF.SetNeedAppearance - DynaPDF.SetOCGState