I am trying to create a very long job application form which needs to have the ability for users to save it as a draft and edit it again later. But I also need to have required fields which are tested when they finally submit (Publish) the form.
Is there a way when saving a form as a draft the testing of required fields can be ignored? I see this question has been asked over the years, but not lately. I'm hoping it's a capability which has been added. If not, are there any creative approaches to address this?
Hello,
I assume we are talking about this case:
1) A custom post type, with a required custom field, for example: single line field "my-field"
2) A post form for for editing post, with above "my-field" field:
[cred_field field="my-field" ...]
3) You are going to submit this form without filling value into "my-field" field
If it is, I suggest you use generic field shortcode [cred_generic_field] to replace [cred_field] shortcode , for example:
[cred_generic_field field="wpcf-my-field" type="textfield" class=""]
{
"required":0,
"validate_format":0,
"default":"",
"persist":1
}
[/cred_generic_field]
Please replace "my-field" with your custom field slug
More help:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_generic_field
Yes, you have stated my case correctly. But I'm sorry, I don't follow how using a generic field helps me. How does that allow the user to save/submit the form when only some of the required fields are filled in?
As you can see, in the cred_generic_field shortcode I mentioned above:
https://toolset.com/forums/topic/ignore-required-fields-when-saving-as-draft/#post-1145574
There is a parameter "persist":1, it will be able to save the field value into database, after user submit the form.
And the parameter "required":0 will setup cred_generic_field as a non-required field.
So the user will be able to submit the form without input value into the field "my-field".
Hope it is clear.
My issue is resolved now. Thank you!