-
- 5,888 Posts
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?
-
- 44 Posts
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.
-
- 5,888 Posts
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')));
-
- 23 Posts
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
-
- 5,888 Posts
which code exactly did you try?
-
- 9 Posts
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?
-
- 23 Posts
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.
-
- 5,888 Posts
your snippet-call is exactly the same as mine in the first post? And your tablename is ’members’ without prefix?
this cannot work.
-
- 5,888 Posts
then your tablename should be: dcvsborg_members