Skip to content

Usage

How it works

The FormIt hooks1 uses the following properties:

Hook Properties for FormIt2db

Property Description Default
prefix Table prefix of the xPDO package MODX DB prefix
packagename Package name of the xPDO object -
classname Class name of the xPDO object -
tablename Table name of the autocreated xPDO Package -
where JSON encoded xPDO where clause - to update a row instead of creating a new one -
paramname Requested POST param - to update a row instead of creating a new one -
fieldname xPDO fieldname the POST param is compared with - to update a row instead of creating a new one 'paramname'
arrayFormat Format to transform form fields that contains array data (i.e. checkboxes) into csv
arrayFields JSON encoded array of form fields that contains array data []
removeFields JSON encoded array of form fields not saved in the xPDO object []
autoPackage Use the autocreated xPDO Package2 false

Hook Properties for db2FormIt

Property Description Default
prefix Table prefix of the xPDO package MODX DB prefix
packagename Package name of the xPDO object -
classname Class name of the xPDO object -
tablename Table name for autocreation of the xPDO Package -
where JSON encoded xPDO where clause - to retreive an existing row -
paramname Requested REQUEST param - to retreive an existing row -
fieldname xPDO fieldname the REQUEST param is compared 'paramname'
with - to retreive an existing row.
arrayFormat Format to transform database fields that csv
contains array data (i.e. checkboxes) into.
arrayFields JSON encoded array of database fields that []
are transformed into arrays.
ignoreFields JSON encoded array of database fields that []
are not retreived into FormIt.
notFoundRedirect ID of the MODX resource the user is 0
redirected to, if the requested row is not
found.
autoPackage Autocreate the xPDO Package with packagename
and tablename2. false

Notes


  1. The snippets base on the code in the following thread in MODX forum https://forums.modx.com/thread/32560/formit2db-with-autocreate-schema-classes 

  2. If the xPDO package is autocreated, the classname in the package is generated by MODX and could be different to a classname set by parameter. If you disable the autoPackage parameter later, please look which classname was generated and change the parameter to that value.