Reference > Script steps reference > Miscellaneous script steps > Show Custom Dialog
 
Show Custom Dialog
Purpose 
Displays a custom message dialog box, with custom text and labels.
See also 
Format 
Show Custom Dialog [<title>; <message text>; Table1::input field 1;...]
Options 
The "Show Custom Dialog" Options dialog box allows you to set the dialog box title, message text, and buttons, and specify up to three fields to use for input or display.
General options
Title specifies the title of the custom dialog box. You can enter literal text or click Specify to create the dialog box title from a calculation.
Message specifies the message of the dialog box.You can enter literal text or click Specify to create the message text from a calculation.
Button Labels specifies how many buttons (up to three) to display in the custom dialog box and labels for these buttons. If you leave a button label blank, the button does not appear in the custom dialog box. If you leave all button titles blank, an OK button displays in the lower-right corner of the custom dialog box. To create a button label based on a calculation, click Specify and then specify the calculation.
Commit Data checkboxes pass input from the dialog box to the database according to the action of each button. If no fields are active, then the data is committed; if a field is active, then the data is committed when the record is committed.
Input Field options
Show input field <n> activates an input field.
Specify selects the field for input. Each input area maps to one field.
Use password character (*) masks text as it is entered, or as it is displayed from the database. This option obscures data being input into the custom dialog box or being displayed, but does not alter the actual data as it is stored in the database.
Label specifies a field label (the text that will identify this input to the user.) You can enter literal text or create the label from a calculation.
Compatibility 
 
Where the script step runs 
Supported 
FileMaker Pro 
Yes 
FileMaker Server 
No 
FileMaker Go 
Yes 
Custom Web Publishing 
No 
FileMaker WebDirect 
Yes 
Runtime solution 
Yes 
Originated in 
FileMaker Pro 6.0 or earlier
Description 
The custom message dialog box can take user input for up to three fields in the database, and display data from up to three fields in the database. The script pauses as long as the custom dialog box stays on the screen. Fields used for input can be of type text, number, date, time, timestamp, or container. Your custom dialog box can also have up to three buttons, with custom button titles.
Use the Get(LastMessageChoice) function to determine which button the user presses.
1 for the first button (by default, labeled OK)
2 for the second button (by default, labeled Cancel)
3 for the third button
Notes 
If values entered into input fields don’t match the field type, a validation error message displays. The user must resolve validation errors before the dialog box can be closed. See Defining field validation for more information.
The fields you specify don’t need to appear on the current layout. Show Custom Dialog input fields are independent of layouts, similar to the Set Field script step.
Data can't be inserted into calculation or summary fields.
Show Custom Dialog ignores any field entry options. See Allowing or preventing entry into fields for more information.
Data entry via the Show Custom Dialog script step is limited by any access privileges criteria that may be in place. (To enable the script for all users, right-click the current script in the scripts pane and choose Grant Full Access Privileges.)
(Windows) You can create a keyboard shortcut for a custom dialog box button by placing an ampersand before the shortcut key letter in the button label. For example, to create a keyboard shortcut ‘D’ (Alt+D) for a button labeled ‘Done’, type the label ‘&Done’.
Before you change the data commitment status of a button for a database that’s already in use, consider the behavior that users currently expect of the button and how changing its behavior could affect the validity of data committed (or not committed) to the database.
To develop more-complex custom dialog boxes, you can use the New Window script step.
Example 1 
Performs a find. If no records were found, displays a custom dialog box.
Perform Find [Restore]
If [Get (FoundCount) = 0]
Show Custom Dialog ["No records were found."]
End If
Example 2 
Creates a new record, prompts the user to enter information, then goes to the Customer Details layout. The first button is Cancel so that users don't inadvertently create a record by pressing Return or Enter in the custom dialog box.
Freeze Window
New Record/Request
Show Custom Dialog ["New Customer"; "Enter information into the fields below:"; Customers::Company; Customers::Name; Customers::City]
If [Get ( LastMessageChoice ) = 1]
Delete Record/Request [With dialog: Off]
Else
Go to Layout ["Customer Details"]
End If
Example 3 
Enters Find mode, prompts the user for find criteria, and performs the find. If the find returns no records, asks if the user wants to find again, and either performs the script again or halts all scripts.
Script: Find
Enter Find Mode [Pause: Off]
Show Custom Dialog ["Find customers by ID, name, or city."; Customers::ID; Customers::Name; Customers::City]
If [Get ( LastMessageChoice ) = 1]
Perform Find [ ]
If [Get ( FoundCount ) = 0]
Show Custom Dialog ["No records were found. Find again?"]
If [Get ( LastMessageChoice ) = 1]
#Calls this script as a sub-script
Perform Script ["Find"]
Else
Show All Records
#Halts all scripts and sub-scripts
Halt Script
End If
End If
Else If [Get ( LastMessageChoice ) = 2]
Enter Browse Mode [Pause: Off]
End If
Related topics 
Script steps reference (alphabetical list)
Script steps reference (category list)