Most Powerful Open Source ERP

Dialog Technical Design

Information on designing a dialog in ERP5
  • Last Update:2016-04-08
  • Version:001
  • Language:en

Tips and information on designing dialogs in ERP5 and prefixing fields correctly.

Table of Contents

Dialog design

Like all form fields, the dialog fields must be prefixed.

Unless it's explicitely desired that the field contains the value of an object property, you must prefix them with "your_". Use the Default/TALES/Override system available on fields to set their default values.

"my_" prefix must be reserved for fields which default value is taken from context object, even in dialogs.

left, right and center groups are displayed in a special html "div", bottom group is displayed between this "div" and the buttons.

When multiple actions are available for the same dialog family, an additionnal html "select" field is added at the top of the html "div". It redirects automaticaly to the selected dialog. If this dialog is actually a script designed to call the dialog after doing some initialisation, make sure to redirect properly (see Important variables section below).

Important variables

Some variables require special attention when designing a script which calls (as in "calling a python method") a dialog.

  • form_id : used to redirect to the "view" or "list" mode after "dialog" mode is over
  • dialog_category : used to display a list of all dialogs belonging to the same catgory
  • cancel_url : used to redirect the user to the page he came from when he cancels the dialog

Dialog actions

There are 3 possible actions which lead the user out of a dialog

  • Base_cancel
    • This action redirects the user to the cancel_url it receives. The dialog must therefor take care of transmiting/generating a correct cancel_url which will lead the user to the page displayed before the dialog was called. The worst case is a dialog called "out of the blue". In this case, "cancel" has no meaning and therefor no defined action - it should at least not lead the user to an error page.
  • Base_showUpdateDialog
    • This action is similar to Base_callDialogAction, with the difference that it calls the Form Update Action set on the dialog Formulator form instead of the Form Action.
  • Base_callDialogAction
    • This action calls or redirects to the Form Action script, as configured on the dialog Formulator form. It takes care of all form validation before transmiting parameters to the action script.
    • TODO: Make Base_callDialogAction call the action script and handle the final redirection (to form or dialog view).

Error handling

When the validation of a dialog field fails, the user must be redirected to the dialog with a translated portal status message.

Remember to use validators for fields instead of checking for errors in the action/update script, whenever possible.

Related Articles