Skip to content

Instantly share code, notes, and snippets.

@alpacaaa
Created March 1, 2010 14:36
Show Gist options
  • Save alpacaaa/318407 to your computer and use it in GitHub Desktop.
Save alpacaaa/318407 to your computer and use it in GitHub Desktop.
public function customDBMS($context)
{
$fieldName = 'changeMe'; // change this to your checkbox field name
$event = $context['event'];
$section = $event->getSource();
require_once(TOOLKIT . '/class.sectionmanager.php');
if (!$this->sectionManager)
$this->sectionManager = new SectionManager($context['parent']);
$section = $this->sectionManager->fetch($section);
$schema = $section->fetchFieldsSchema();
$found = false;
foreach ($schema as $field) {
if ($field['element_name'] == $fieldName) {
$found = true;
break;
}
}
if($found && $context['fields'][$fieldName] != 'on')
{
$context['messages'][] = array($fieldName, NULL, 'You must agree to the terms and conditions by checking the waiver box.');
}
return;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment