having trouble with error reporting on php plugin clearing data on form.

Status
Not open for further replies.

skyrun

Active Member
i ahve a php plugin onAfterProcess that includes this at the end:

// throw error back to fabrik if there is no-one to email or text to
$formModel->setFormErrorMsg("No one to email or text.");
$formModel->errors['srms_group_email_text___description'][] = '';
return false;

the error is showing (along with some parts of your form have not been correctly filled in, which i wish could be removed).View attachment 17247
however the form data is cleared... i haven't run into this before, so i'm stumped what would cause it.

  • 'record in database' is set to 'yes' on the form.
  • when element validation fails, the form DOES show persistence in what has been filled in. just not when my php form plugin triggers the error.
  • i tried with and without text in the error message on the element. (tried '' and '.')
 
I suspect it's because it's onAfterProcess, so the form data has already been written out to the database. I think at that point we'd redirect back to the new form, not do the same thing we'd do on a validation fail.

You'd need to run in onBeforeProcess if you want the validation to fail and redisplay the form data.

-- hugh
 
Status
Not open for further replies.
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top