Trying to figure out Formit2DB here. So far I have this:
1. Install it.
2. Create a table.
3. Add the hooks to the FormIt snippet
At this point I'm stuck. I have a table:
CREATE TABLE `modx_customer_preferences` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`colors` varchar(25) NOT NULL,
`numbers` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Customer preferences' AUTO_INCREMENT=1 ;
Attempting to use a modified version of the FormIt simple contact form tutorial's example for this, I have this snippet call:
[[!FormIt?
&hooks=`spam,formit2db,email`
&preHooks=`db2formit`
&prefix=`modx_customer_`
&packageName=`customer`
&classname=`customer`
&tablename=`preferences`
&autopackage=`1`
&emailTpl=`MyEmailChunk`
&emailTo=`[email protected]`
&emailSubject=`Web Contact`
&validate=`name:required,
email:email:required,
subject:required,
text:required:stripTags,
numbers:required,
colors:required`
]]
MODx returns
Failed to create object of type: customer
and in the error log, as soon as I load the page, I get
[2014-01-02 07:19:31] (ERROR @ /formit2db/index.php) addPackage called with an invalid package name.
[2014-01-02 07:19:31] (ERROR @ /Applications/MAMP/htdocs/formit2db/core/cache/includes/elements/modsnippet/5.include.cache.php : 34) PHP warning: in_array() expects parameter 2 to be array, string given
[ed. note: sottwell last edited this post 10 years, 4 months ago.]