Skip to content

Instantly share code, notes, and snippets.

@romaninsh
Created July 10, 2014 12:48
Show Gist options
  • Save romaninsh/9ebdfb032dadbdb15dca to your computer and use it in GitHub Desktop.
Save romaninsh/9ebdfb032dadbdb15dca to your computer and use it in GitHub Desktop.
ATK4.3 default form submission handler syntax
$form->onSubmit(function($f){
$errors=[];
if($f['name'] != 'Joe') $errors[] = $f->error('You must be Joe');
if($f['surname'] != 'Blogs') $errors[] = $f->error('You must be Blogs');
if($errors) return $errors;
$f->update();
return 'Success!';
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment