Skip Navigation

[Resolved] Not user friendly location of the error message on CRED form

This support ticket is created 3 years, 2 months 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by himanshuS 3 years, 2 months ago.

Assisted by: Waqar.

Author
Posts
#2169413
error message_job_form.png

In a CRED form, all the fields are mandatory but if the user leaves the form empty and clicks on the submit button, then an error message appears on the screen” The Project Prompt was not saved because of the following problem” and the “the field is required “ message only appears below the “Project Title” field.

Why does that happen?

Some of the fields are mandatory at the field level and some are made mandatory by using cred_save_data.

#2170599

Hi,

Thank you for contacting us and your observation is correct.

The messages for the required fields are shown in line with the fields and not under the main notice "The Project Prompt was not saved because of the following problem".

Only the error messages, that are added through the "cred_form_validate" hook are shown under the main notice:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_form_validate

In the background, the validation takes place in two steps:

1. First the default validation checks for the required status of the fields and if any required field is not filled with data, it will stop the forms processing or any further validation rules added through the "cred_form_validate" hook.

2. If the default validation for the required fields is passed, then the additional validation rules added through the "cred_form_validate" hook will be checked and if they are passed too, only then the form's submission is completed.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#2171223

Waqar,

Thanks for the response. If your first point is true then the error message main notice should not show when the standard mandatory fields are empty. But that is not happening here.

Somehow the cred_form_validate is being triggered even if the mandatory fields are empty. Why would that happen?

#2173679

Thanks for writing back and I feel there has been some confusion.

In my last message, I wrote:
> The messages for the required fields are shown in line with the fields and not under the main notice "The Project Prompt was not saved because of the following problem".

But, I didn't mean to imply that the main notice itself is not shown at all.

Here is how it works, by default:

1. If any of the required fields are not filled, the main notice shows, but the error is shown in line with the field.
( screenshot: hidden link )

Note: the main notice is dismissable at this stage, i.e. it vanishes, if you click anywhere on the page.

2. If the default validation for the required fields is passed, then any custom validation rule's errors are shown under the main notice and not in line with the fields.
( screenshot: hidden link )

Note: the main notice is not dismissable at this stage.

If you notice any different behavior on your website than what is explained above, please go through all your custom code snippets and make sure that there is no custom validation rule added through "cred_form_validate".

#2174169

My issue is resolved now. Thank you!