decorative banner

Understanding update actions


    Form actions cause some action to occur when a form submit button is pressed. Generally, the action affects the record or records that are displayed in the form. GoLive provides five actions (Update Record, Add Record, Delete Record, Clear Form Data, and Copy Form Data) that can be attached to form submit buttons. There are also some update actions specific to the GoLive e-commerce Custom Merchant feature.

    In addition to the predefined actions, new actions can be defined and added to a site using the GoLive extensibility mechanisms.

    Tip iconWhen you enable a form action in the Dynamic Bindings palette, the form action URL is automatically set to the proper page in the config/actions folder in your site. You cannot change it in the Form Inspector. The form method is also automatically set to Post. This must not be changed. (The form method controls how the form fields are sent to the server.) Be sure to set the content source in the Dynamic Bindings palette as part of setting the form action, if one is requested. Fields in the form must be bound to this same content source.

    There are a number of different situations that can arise when creating pages with forms displaying records. The page can be designed to display a single record. In this case, you can place a form action button such as Clear (form action = Clear Form Data) to create a blank form for later insertion of new records. You can place a form action button such as Copy (form action = Copy Form Data) to create a new form filled in with the current data, but ready to be inserted into the database as a new record. You can place a form action button such as Update (form action = Update Record) that takes the data from the form, and writes it back to the database (into the same record from which it came). You can place a form action button such as Add Record (form action = Add Record) that creates a new record in the database using the data that is on the form. Finally, you can place a form action button Delete (form action = Delete Record) that deletes the current record in the database.

    Illustration of form actions attached to buttons to let you edit records in an online database. Callouts include: A. Clear Form Data creates a blank record, B. Update Record updates a record with any changes you've made, C. Copy Form Data creates a new record with data from the current record, D. Add Record creates a new record in the database, and E. The online database file stores the records.
    Form actions attached to buttons let you edit records in an online database: A. Clear Form Data creates a blank record. B. Update Record updates a record with any changes you've made. C. Copy Form Data creates a new record with data from the current record. D. Add Record creates a new record in the database. E. The online database file stores the records.

    Forms may also display more than one record. This can be done by placing a table in the form, placing form fields in a table row, binding the form fields to fields of a content source, and then setting the Repeat Rows property of the table in the Dynamic Bindings palette. If you have more than one record shown on the same form, the Update Record form action updates all of them. This allows you to easily create pages from which a number of records can be updated in a single operation.

    Note: Actions Clear Form Data, Copy Form Data, and Add Record and Delete Record are not allowed from a form that shows more than one record.

To create a form connected to a content source:

  1. On a static (HTML) or dynamic (ASP, JSP, PHP) page, drag a Form object from the Forms set of the Objects palette to the page. Place other form elements in the form. Use a layout grid, tables, or other layout techniques to position the form elements. All form fields need to be nested within the form itself. You can use form elements from the Forms set of the Objects palette or, if the page is already dynamic, you can also use the bound form objects from the Dynamic Content set of the Objects palette.
  2. Add Form Submit buttons for the various actions you want to define.
  3. Once the page has the appearance that you desire, make the page dynamic (if you haven't already). It does not matter if you make the page dynamic before or after building the form.
  4. Bind the form fields to content source fields.

To add a form action to a page:

  1. Create a form page. Add one or more Submit buttons to the form.
  2. Set a form action on one or more Submit buttons, using the Dynamic Bindings palette.
  3. If the button directs you to a page that's different from the current page, set the On Success, Redirect To option and On Failure, Redirect To option. If these fields are not set, the same page will be displayed again after the form button is pressed.
  4. When creating dynamic content pages that contain forms, you'll need to keep the following general principles in mind:

    • There needs to be at least one Submit button with some sort of form action set.
    • The form action URL is automatically set by GoLive. Any URL value you set in the Inspector will be ignored.
    • The form method needs to be POST.

    Building forms on a dynamic content site doesn't differ substantially from creating forms on regular sites, but the GoLive Dynamic Content module does let you construct pop-up menus, list boxes, and radio button groups dynamically, populating them with names and values from an online database. Here are several examples you can study and customize for your own sites.