you need a field which holds the id:
<input name="resource_id" type="hidden" value="[[+fi.id]]" />
for permission you can check in formit2db or formit2resource if the user==author.
if not return with a formit error-message.
btw. : are you now creating modx-resources or datas in custom-table?
yes you correctly write for modx-resources you need to add
<input name="resource_id" type="hidden" value="[[+fi.id]]" />
but I edit the custom-table.
this is ok, also for custom-table.
In formit2db it uses this field to find your dataobject.
See this line in formit2db:
$dataobject=$modx->getObject($classname,array('id'=>$hook->getValue('resource_id')));
Hi,
I tried the above code, however, I get the message : "Failed to create object of type: Members". "Members" is my table name.
I’m a noob, hence don’t know what ’m I missing here.
Thanks,
Vishal
which code exactly did you try?
Hello,
i´m new hier and i have the same problem like vishalashah.
When i try to save the form it failed and i get the message ’Failed to create object of type:...’.
Have somebody a solution?
The code in the first post. The formit snippet call and then created db2formit and formit2db snippets. The model folders under the component appear to be created as expected.
your snippet-call is exactly the same as mine in the first post? And your tablename is ’members’ without prefix?
this cannot work.
then your tablename should be: dcvsborg_members