Database Reference
In-Depth Information
Figure 17-7. Top: The Input Fields tab lets you add fields to a custom dialog box so users can sup-
ply more information than they could just by clicking a button. You can use input fields for actual
data input into the current record. In this case, you might script data entry for posting a payment
on an Invoice. Bottom: Here's the dialog box people see when the script runs. If you turn on the
Commit Data option for button 2, FileMaker puts the data into the fields you've specified and then
commits the record.
The fields you add to a custom dialog box have some limitations, including these:
▪ Show Custom Dialog can have only free-entry fields like those shown in Figure 17-7 .
You can't use radio buttons, checkboxes, calendars, or pop-up menus. You also have no
control over the size of the field, so you can't specify, say, short fields for dates or tall
fields for lots of text.
▪ “Data-entry only” validation doesn't apply to fields in custom dialog boxes. If you use a
dialog box to gather data for a record, either use the Always option in the field valida-
tion, or check the validity of the data in your script ( Branching and Looping in Scripts ) .
▪ Data can't be inserted into fields that the users' privileges don't give them access to. You
can get around this limitation by turning on the “Run script with full access privileges”
option for the script.
Building a Custom Layout
If you need to use more than three fields for capturing user input, or you want to provide reg-
ular field controls like radio buttons or pop-up menus, you can create a fully custom dialog
box using a new window, a layout, and some scripts. Back on Communicating with Database
Users , you learned how a modal layout works. This behavior is the heart and soul of a dialog
box: “No rush. I'll just sit here until you give me what I want. No, you can't click on that
other layout. No, you can't run another script. Just follow instructions and then I'll give you
control back.”
There are a lot of moving pieces for building a custom layout that functions like a dialog
box. First, you need a layout that shows the objects you need. You can use text objects on the
layout to show messages, field controls to gather input, and layout buttons to run or continue
a script. Once you've got the layout just the way you like it, you need a script that creates a
new window with the Dialog Window option turned on. Figure 17-8 shows one script that
will do the job.
Search WWH ::




Custom Search