I would rename that table, so you have an unique prefix, for example:
modx_custom_addgoods
now you can call formit with:
[[!FormIt?
&hooks=`spam,formit2db,email`
&preHooks=`db2formit`
&prefix=`modx_custom_`
&packageName=`goods` <- here the Name for your new package
&tablename=`addgoods`
&emailTpl=`myEmailChunk`
&emailTo=`[email protected]`]]
make sure your folder /core/components is writeable.
The prehook db2formit should now create the new package ’goods’ with schema and xpdo-classes automatically under /core/components/goods/
Does it?
Now db2formit and formit2db can read and write from your table per xpdo.
more questions?
hmm... this should work.
You have the latest version of formit?
FormIt 1.5.0-pl
MODx Revolution 2.0.4-pl2
Perhaps there are errors in the form?
Do you see errors in your error-log?
what do you get when you alter this lines in formit2db:
//$errorMsg = '<pre>'.print_r($scriptProperties['fields'],true).'</pre>';
//$hook->addError('error_message',$errorMsg);
to
$errorMsg = '<pre>'.print_r($scriptProperties['fields'],true).'</pre>';
$hook->addError('error_message',$errorMsg);
or to
$allFormFields = $hook->getValues();
$errorMsg = '<pre>'.print_r($allFormFields,true).'</pre>';
$hook->addError('error_message',$errorMsg);
Do not know how, but after reinstalling fofmit and re-created formit2db it worked.
Thank you very much for your help and for this wonderful snippet!
hello again
I have another problem
when editing the resources I add to the URL & resId = 10, appear in the form of resource data 10 but when you save does not update resource 10, and creates the following resource 11 with data from the form. how to fix?
and how best to do a background check on the right to edit the resource only by the author?