Creating a Button that Calls an Action Script

Description

Configure a button that uses an action script and the OnPush Event. This page contains a code explanation.

Button2 uses an Action Script to copy the customer billing address to the shipping address. Button2 uses a bitmap instead of text to define its purpose.

 Procedure: Configuring the Button2 Button

The following procedure assumes that the developer has opened the form in the Form Editor. Follow these instructions to create a button similar to Button2 :

  1. Place a button on the form.

  2. On the resulting Define Button dialog box click the Define Picture button.

  3. Click the Internal combo box to open it up.

  4. Select the image in the resulting Insert Image dialog box.

  5. Click the Addin images radio button.

  6. Click the Insert button.

  7. In the Define Picture dialog box click the OK button.

  8. In the Define Button dialog box click the Next button.

  9. Click the Add New Action button to start defining an Action Script (refer to ((|#Button2_OnPush_Event|Button2 OnPush Event)) ).

  10. If you are in the Code Editor, close and save your code.

  11. Click the Finish button.

 Action Script Run by the Button2 OnPush Event

Clicking Button2 runs the following Action Script, which displays a dialog box to confirm that the user wants to copy the shipping address to the billing address and copies the shipping address to the billing address.

Display a Message Box(ID 'copyAddress')
Set Field Values

 An Explanation of the Code

The follow Action displays a message box to confirm that the user wants to copy the shipping address to the billing ' address.

Display a Message Box(ID 'copyAddress')

If the user clicks OK, the following Action copies: Ship_country to Bill_country, Ship_zip to Bill_Postal_Code, Ship_state to Bill_State_Region. Ship_city to Bill_city, Ship_address_1 to Bill_address_1, and Ship_address_2 to Bill_address_2.

Set Field Values

See Also