Designing a form that prompts users for information
About this task
You can design a form that uses @Prompt to request information from users to help them fill out a document. This function is similar to @DialogBox, but it is simpler: @Prompt contains only text and doesn't interact with any other forms.
Procedure
- Create a form.
- Create a button, hotspot, or action that will store the @Prompt formula.
- Click the button, hotspot, or action.
- In the Objects tab on the Info list in the Programmer's pane, select the Click method for the button, hotspot, or action.
- In the Script area of the Programmer's pane, enter an @Prompt formula.
- Save and close the form.
Examples: Using @Prompt
[YesNoCancel]
About this task
This formula displays a warning before a memo is sent, giving users a chance to select Yes, No, or Cancel.
Result := @Prompt([YesNoCancel]; "Send memo?"; "This memo will be sent to everyone listed in the To, CC, and BCC fields." );
[OkCancelEdit]
About this task
This formula fills the Name field with the user's response to the prompt. The default value is the user's Notes® name. If the user selects Cancel, Notes® cancels the formula evaluation.
FIELD Name := @Prompt([OkCancelEdit]; "Enter Your Name"; "Type your name in the box below."; @UserName);
[OkCancelList]
About this task
This formula captures the user's response in a temporary variable called ComposeType and uses it to create a new report using the appropriate form.
ComposeType := @Prompt([OKCancelList]; "Report Type"; "Choose a report type."; "Adjustment Report";"Adjustment Report":"Infant Progress Report":"Toddler Progress Report":"Preschool Progress Report":"Transition to Kindergarten Report");
@Do(@Command([Compose]; ""; ComposeType));