Skip to content

Instantly share code, notes, and snippets.

@Da-Fecto
Last active August 29, 2015 14:01
Show Gist options
  • Save Da-Fecto/060f451a8de691bab29a to your computer and use it in GitHub Desktop.
Save Da-Fecto/060f451a8de691bab29a to your computer and use it in GitHub Desktop.
clear error ProcessWire
<?php
wire()->addHookAfter('InputfieldForm::processInput', function($event) {
$form = $event->object;
if($form->name != 'your-form-name') return;
$email = $form->getChildByName('email');
if($email) foreach($f->getErrors(true) as $error) { // true clears existing errors
if($error == 'Missing required value') {
$f->error('Please enter a valid email address'); // replace error message
} else {
$f->error($error); // other error, stuff it back in there
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment