Creating a modification block
A modification block is a database-driven form that is used to modify an existing record in a database. The form is contained in a table.
A simple modification block in Preview mode
Starting the Database Wizard
- Place the insertion point anywhere in the current document.
- On the Develop menu, go to Database, click Block, and then click Modification Block.
Step 1: Document Type
- Click the Script type box and select the dynamic document standard you want to use.
- Click the Database box and select the appropriate connection method for your database. (If you chose ASP as the script type, you will only be able to select ODBC.)
- Click Next.
Step 2: Data Source
- Do one of the following, depending on your selection in the Database box in Step 1 of the wizard:
- If you chose ODBC: Click the Data source box and select the ODBC data source corresponding to your database.
- If you chose MySQL:
- In the MySQL host box, enter the hostname or IP address and port number of your MySQL server, replacing the text within brackets. Also delete the brackets.
- In the MySQL DB name box, enter the name of your MySQL database.
- If you chose one of the JDBC connection methods (for a JSP document): In the Data source URL box, replace the parameters in brackets with appropriate values for your database. Also delete the brackets.
- If your data source or database is password-protected, fill in the User ID and Password boxes.
- If you chose a connection method other than ODBC in Step 1 of the wizard, click the ODBC DSN for preview box and select the ODBC data source corresponding to your database.
- Click Next.
Step 3: Database Fields
- For each database field you want to include in the modification block, select the field in the box on the left and click Add. To add all the fields in a table, select the table and click Add. (Note: for a modification block, you can only include database fields from one table only. The wizard will not allow you to include fields from multiple tables.)
- Click Next.
Step 4: Selection Statement
- In the Filter box, enter a filter condition to select the record to be modified. (For information about configuring a modification block to display a specific record depending on the value of a parameter in the URL, see “Using parameters with database-driven documents“.)
- Click Next.
Step 5: Block Elements
- If you want to remove one or more unnecessary block elements, select each and click Remove.
- Click Next.
Step 6: Input Method
- Click either the GET option or the POST option, depending on how you want the browser to submit the data in the modification block to the Web server. POST is usually preferable, since this method imposes no limit on the amount of data that can be submitted. Choose GET only if you have a specific reason to do so.
- In the Result page URL box, enter an optional path or URL for a result page. If you leave this box empty, users will see a simple “Input process complete” message when they submit the input form. A more useful result page might be a document that contains a table block or list block displaying the latest records in the database table that was just updated.
- Click Finish.
When you finish the Database Wizard, the modification block will be inserted into the current document. In Edit mode, the block will initially look something like example below:
Example of an modification block in Edit mode before modification
The input elementA form field in an input block. An input element accepts user data that will be inserted into a database. placeholders in the right column are shown with example values that indicate the type of the input element. To change the properties of an input element, double-click it.
The default element labels in the left column are simply the names of the database fields you selected in Step 3 of the wizard. Since these labels are static, plain text, you can replace them with any content you want.
You can replace a box-type input element with a database-driven drop-down menu or radio button group. This is useful when you want to restrict the values users can input in a particular database field, or you want to display a menu of possible selections instead of forcing users to enter a numeric value (such as Orders.Product in the example above).
You can format a modification block as you would an ordinary table. You can also format the text inside it and add static content, such as images. For more information about formatting a block, see “Formatting database-driven content“.
Related topics
Using parameters with database-driven documents
Modifying input element properties
Replacing an input box with an input control
Formatting database-driven content