Martijn Geerts Posted February 7, 2014 Posted February 7, 2014 This POST here is a Formbuilder post, but it's not specific to Formbuilder as it's usefull for other API related errors. What I want is remove "Missing required value" and add a custom error in. The only thing I can achieve is adding a new error on top of the error array. $forms->addHookAfter('InputfieldForm::processInput', null, 'hookProcessInput'); function hookProcessInput(HookEvent $event) { $form = $event->object; $firstname = $form->get('firstname'); if($firstname->error('Missing required value')) { // here the stuff I don't get } }
Soma Posted February 7, 2014 Posted February 7, 2014 Why remove? Why not just hook before and do what you need to do? Also I think you could leave it not required and add that via js or css. Also you could try hook before on inputfieldText directly. BTW your if() adds a error. 1
Martijn Geerts Posted February 7, 2014 Author Posted February 7, 2014 Thanks for your reply Soma, gonna investigate the before hook.
Soma Posted February 7, 2014 Posted February 7, 2014 And use $event->replace = true; and do your own validation. 1
Martijn Geerts Posted February 8, 2014 Author Posted February 8, 2014 I ended up with a simple str_replace on the output of the formbuilder form. It's not ideal, but works for now.
ryan Posted February 9, 2014 Posted February 9, 2014 You can also use language support and translate any of ProcessWire's built in messages to your own (including default language).
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now