Jump to content

Recommended Posts

Posted

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
	}
}
Posted

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.

  • Like 1
Posted

You can also use language support and translate any of ProcessWire's built in messages to your own (including default language). 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...