Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 7.5   8.0   8.1   8.2   8.3   8.4   8.5   9.0   9.1   9.2    Statistic  


Limits textfield to only accept numbers.

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


Parameter Description Example value
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.
DecPlaces Number of decimal places 2
NegStyle Negative number format.
Can be MinusBlack, Red, ParensBlack or ParensRed.
CurrStr Optional
The currency string.
Or empty for no currency.
Prepend Optional
Position of Currency string.
Pass 1 to prepend or 0 to append.


Returns OK or error.


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

See also SetNumberFormat function in DynaPDF manual.


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

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

DynaPDF.SetMiterLimit   -   DynaPDF.SetOCGState

Feedback: Report problem or ask question.

MBS Xojo Plugins