Hi,
Sorry for the mass of questions today. I have some javascript that dynamically adds forms to a page when you double click and I would like to capture all of the data and send it to a template variable related to the resource they were created on.
I'm a little confused though how I would get formit to register the values if they are dynamically added. I assume I would use a hook after submitting and use the setTVvalue method? I've tried creating a hook with a static value first of all to see if the hook would update the TV and most of the time it doesn't work - I've tried clearing cache manually and in the manager.
The hook/snippet I have is this:
<?php
$id_resource = $modx->resource->get('id');
$id_tv = 46;
$value = 'Updated Value';
$tv = $modx->getObject('modResource', $id_resource);
$tv->setTVValue('$id_tv', 'This is my hook value');
$tv->save();
So essentially two questions.
1) What is wrong with my above hook/snippet?
2) How do I capture dynamic form values to pass them into the snippet and ultimately save them to the TV?
Thank you.