Last active
August 29, 2015 14:01
-
-
Save Da-Fecto/060f451a8de691bab29a to your computer and use it in GitHub Desktop.
clear error ProcessWire
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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