I’ve installed FormIt and I’m considering using it as a way to validate searches. I have a very simple form right now (just a single field for a "searchterm"), and my FormIt call looks like this:
[[!FormIt?
&hooks=`search_my_table`
]]
So literally, I’m doing nothing right now but having my custom Snippet "search_my_table" pick up the ringing phone after the form is submitted.
In "search_my_table", I am successfully performing the search and I get some formatted $output... but I cannot seem to get this back to the browser! If I exit the Snippet prematurely, I can see the search results:
print $output; exit; // <-- this shows my search results
Normally, I’d be accustomed to returning the $output:
return $output; // <-- with this option, the search results never show.
The man page here
http://rtfm.modx.com/display/ADDON/FormIt#FormIt-Customhookreturnvalues shows how to return an error message, e.g.
$scriptProperties['hook']->errors['searchterm'] = 'Something went wrong';
Presumably, these types of messages will percolate down to the placeholders on the page, e.g.
<p>[[+fi.error.error_message]]</p>
<span class="error">[[+fi.error.searchterm]]</span>
What other methods are available to $scriptProperties[’hook’]? I don’t see any other examples here:
http://rtfm.modx.com/display/ADDON/Login.Using+Pre+and+Post+Hooks
Thanks for any tips!