Skip Navigation

[Resolved] Hook into CRED Form submit action

This thread is resolved. Here is a description of the problem and solution.

Can I hook in or filter a CRED Form submission, to add my own custom events?

The CRED API allows you to add your own custom application logic to CRED Forms when they are submitted.
A full comprehensive List of those actions and filters is here

This support ticket is created 8 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 7 replies, has 3 voices.

Last updated by AlexanderR5202 8 years ago.

Assisted by: Beda.




I am trying to get a submitted form with errors to keeps it values.

Currently when using the cred form the generated inputs keep their values, which is perfect! But I have a select-input which will be used for tagging, by using selectize.js. The issue here is that when submitting the form which has errors the page reloads displaying the errors and also refilling the form for the inputs defined by the cred_fields but not for the custom select-input. That's normal but not perfect.

I assume that the cred_fields are filled via PHP before they get sent to the browser for rendering. So I wanted to know if there is a way that I can get my select-input modified before rendering? Like a hook maybe?

Thanks a lot for the help!


You can see a list of API functions here:

We also have a validation Filter

But those functions act as filters and actions to do things with your information on Form Submit. I'm not sure those can help with your Custom Code you use.

I suspect rather it's an issue with your Select Field and how it's populated, something we can't help with as it's not part of CRED or Toolset.

Let me know if that list of CRED API helps you.



Unfortunately the hook I need would be one that gets called before the form gets sent to be rendered. The current API functions only allows manipulation of the data that had been sent/submitted to the server.

I also noticed that when the form reloads because of an error that the selected files are not refilled. Even if the files inputs are generated via CRED.

I understand that currently there's no way to handle custom inputs which are not generated by CRED but is there at least a way to have the file inputs filled?


All Hooks apply after the form is submitted, as we need something to work with.
It's not possible to do on the fly PHP actions.

The first hook is the validation hook, then the cred_before_save_data, then cred_save_data, after cred_submit_complete and so on.

So, with the cred_before_save_data you can do things before they get saved into the DDBB.

Regarding the Fields unset on error trigger, this is solved in the next CRED release.

Do you need more help with the issue on this thread?




if I understand correct then I can modify the data with cred_before_save_data which will also be showed changed when the form gets displayed again with an error? E.g

1. user submits form
2. some input values (current date format: dd/mm/yyyy) gets changed (new date format: with the cred_before_save_data hook
3. in php an error will be set because some data (email format) are wrong
4. the form gets rendered in the browser with the changed date format (new date format: and the error that the email format is wrong

Is this correct?


cred_before_save_data performs your actions custom action right before saving or processing any data but AFTER validation.

The issue with the things that are not selected, or values lost, on validation, when you submit the form, is a BUG, as I elaborated above, and will be addressed in the upcoming CRED release.

The validation is the first thing triggered and it will not update anything to the Database at this moment.

If you want to change the Forms value you need to address $POST (form data)

This is not included in the CRED API.



I will wait for the update.

And ok, I was hoping to find another solution than with the $_POST var.

Thanks anyway!


i look forward to this update too. currently have users trying to submit posts through cred, and they all have trouble as when a single mistake in url or link will reset many fields, and some users either dont notice or simply give up. make me not use the whole CRED and forms for my website because of this. looking for workaround now.

urgently needs an update or workaround, at least to allow display error message on the fly before submitting the form or not resetting all the fields when form submitted with error.

fingers crossed

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.