Hi all,
Firstly if this is considered double posting, please feel free to delete it. I simply post here as I think my query has now move more into the realms of eForm rather than my original query about the Modx API. The original post may be found here:
http://modxcms.com/forums/index.php/topic,9175.0.html
I’m fairly confident that my problem is due to my own lack of PHP knowledge, but I’d appreciate any tips on how to work around the problem -- or indeed identify it!
When i call the following function from the eFormOnBeforeParse event
function getCategories(&$fields1) {
//Get child folders
$pCategories = $modx->getDocumentChildren(26097, 1, 0, 'id, pagetitle, description, alias, parent');
if (!empty($pCategories)) {
$output = "<label accesskey=\"s\" for=\"department\">Subject</label>\n";
$output .= "<select name=\"folder\">\n";
foreach($Categories as $category) {
$output .= "<option value=\"".$category['id']."\">\"".$category['pagetitle']."\"</option>\n";
}
$output .= "</select>";
//Assign $output to placeholder
$output = $fields['categoryOptionBox'];
return true;
}
}
return '';
The page with the eForm call leads to the following error:
Fatal error: Call to a member function getDocumentChildren() on a non-object in C:\sokkit\site\modx\manager\includes\document.parser.class.inc.php(733) : eval()'d code on line 9
Any advice much appreciated, and like I said apologies in advance if this is considered double posting (please remove).
Cheers
Steve