Skip to content

Instantly share code, notes, and snippets.

@jbroadway
Created February 18, 2013 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jbroadway/4978476 to your computer and use it in GitHub Desktop.
Save jbroadway/4978476 to your computer and use it in GitHub Desktop.
Form hook handler for Elefant form app.

Save the formhook.php file to apps/test/handlers/formhook.php then add this to the [Hooks] section of conf/config.php:

form/submitted[] = test/formhook

Create a form and enter a test submission through it on the website (I just embed it on a page with the Dynamic Objects > Embed a Form option in the wysiwyg editor). You should see something like the following in cache/_form_values_.txt:

{"form":"1","values":{"name":"Joe User","email":"joe@example.com","comments":"Testing."}}
<?php // apps/test/handlers/formhook.php
if (! $this->internal) {
die ('Cannot be called from a web browser.');
}
file_put_contents ('cache/_form_values_.txt', json_encode ($data));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment