Skip Navigation

[Resolved] need to make fields on the cred required

This support ticket is created 3 years, 9 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 16 replies, has 2 voices.

Last updated by edr-2 3 years, 9 months ago.

Assisted by: Christian Cox.

Author
Posts
#1649479

Tell us what you are trying to do? i am finding fields have missing data on the post type after they fill out a form

Is there any documentation that you are following? well i looked at various solutions but don't see an easy way

Is there a similar example that we can see? well at hidden link you can see empty fields

What is the link to your site? hidden link has the form

#1649489

Hello, do you want to also make the fields required in wp-admin, or only in the Form?

If you want to make the fields required in both places, you can edit the custom field in Toolset > Custom Fields > Post Fields to make them required. If you only want to require them in Forms, the process isn't as simple as it requires custom PHP code. The Form API cred_filter_field_before_add_to_form can be used to modify field parameters, including whether or not the field is required:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_filter_field_before_add_to_form

Another ticket contains some sample code you can use as a baseline: https://toolset.com/forums/topic/cred_filter_field_before_add_to_form-not-working-in-php-7-1/#post-1268509

Let me know if you have questions about that.

#1649743
access.png

ok thanks so much so far... having seen to it that the fields i want can be required ( editing custom fields post fields )
i want to make sure that peeps can see the edit button for them at the bottom. see attached access settings - ( i am not even sure this is the right place to show you the access perms but anyway... ) can you see any problems? i was talking to someone who had filled out the form earlier, i published the post that goes along with the form, but he was unable to see the edit link at the bottom.
perhaps it was his browser or something else... thanks for reviewing the image i am sending.

#1650599

do the users need to login in order to edit their filled out form? there is currently no login form on the site, how do i grant permission for them?

#1650649

i want to make sure that peeps can see the edit button for them at the bottom.
I assume this button is created using the toolset_edit_post_link shortcode, correct?
https://toolset.com/documentation/user-guides/front-end-forms/cred-shortcodes/#toolset-edit-post-link
If not, please clarify.

do the users need to login in order to edit their filled out form?
If you do not require a login then each visitor is a Guest in WordPress terminology. That means they have no User profile, no unique User ID, no login, etc., and so they cannot be tracked as the post's author using any means built-in to Toolset (it would require custom code that falls outside the scope of support we provide here in the forums, unfortunately). Furthermore, when an admin publishes a post that was submitted by a Guest in Pending Review status, the admin becomes the author of that post and the Guest has no further association with that post. If you want to allow a Guest User to edit his/her own post with Forms, then you would have to allow all Guests to edit all others' posts with Forms, because there is no built-in way to track which Guest submitted which post. If you only want each visitor to be able to edit his or her own post, then you must require visitors to create a profile and login, or use custom code.

You can allow visitors to create their own profile with a User Form that creates new Users ( from wp-admin go to Toolset > User Forms to set up such a Form ). Place the Form on a public page or post on your site and be sure the permissions in Access Control are set up to allow Guests to create new Users with this Form. Then Users can log in at the same URL you use to log in to WP (hidden link), or you can set up a custom front-end login page. Example custom Login / My Account page: https://toolset.com/documentation/user-guides/front-end-forms/building-the-my-account-page/

#1650797

the form originally had no shortcode ie;
[toolset-edit-post-link content_template_slug="template-for-editing-posts"]Edit %%POST_TITLE%% with a Toolset Form[/toolset-edit-post-link]
but just fields to fill in. many of them were not required fields, but since folks have left them blank, i have made those fields required as of now.
however, those whose fields were left empty need filling by the users - and now i have put in the shortcode
[toolset-edit-post-link content_template_slug="template-for-editing-posts"]Edit %%POST_TITLE%% with a Toolset Form[/toolset-edit-post-link]
at the bottom of the post. is this what i needed to do in order to have the original user be able to complete the form? or do i need to do this myself, after having obtained their data?
thanks again for all your help.

#1650813

is this what i needed to do in order to have the original user be able to complete the form?
That is the proper method to create a link or button to edit a post with Forms on the front-end of the site. The usual process is that you create an "Edit Post" Form for this post type first, then insert it in an unassigned Content Template. Normally you would do those steps before you create the toolset-edit-post-link shortcode, because during the shortcode creation process you must select the unassigned Content Template that contains the Edit Post Form.

In addition to creating the Form, Content Template, and Edit Post Link shortcode, you must apply the desired Access Control settings to this Edit Post Form. If the correct settings are not applied, some users may not see the Edit Post Link or the Form. As I was explaining in my last comment, the correct settings depend on whether you intend to require a login or not. If not, be aware that Guest users will be able to edit more than just their own post, since there is no way to programmatically determine which Guest created each Guest's post.

#1650829
new-content-template.png
edit-form-capture.png

so you are saying i must
1. create a login form ( normal wordpress login)
2. somehow retroactively recreate the form according to the process indicated.
and after the user logs into the site they will be able to go to their own form and see the shortcode enabling them to edit
do i have that correct?
and 3. is there information on this attachment to indicate those objectives have been met? or if not, in the creation of the content template, what check boxes should i be checking? they are filling out an attorney set of fields.
4. after having created the content template, how do i assign the already created form to it?

#1650889

1. create a login form ( normal wordpress login)
The only reason you would have to add a login form is if you are opposed to having your Users login at wp-admin. If that is the case, then you must insert a login form somewhere else in the site. You do not have to create a login Form, or build one using Toolset Forms. A basic WP login form is available by shortcode, so there's no form building or coding required. The Login Form shortcode available in the Fields and Views popup will insert a login form on the site. I also shared a link earlier that shows an example of such a login form built into a custom my-account page.

2. somehow retroactively recreate the form according to the process indicated.
No, if you have already created an Edit Post Form, there is no need to recreate it or create a different one. Use the Form you have already created. I was just pointing out the normal process for your information.

and after the user logs into the site they will be able to go to their own form and see the shortcode
The User goes to their own post and sees a link to the Edit Post Form. I think you understand. You mentioned that you had added the shortcode at the bottom of the post. Did you insert the edit post link shortcode directly in the post contents, or in a template assigned to the post? If it's the former, let's fix that because you can't expect your Users to add this in their posts. You should add the shortcode to a template so it will be displayed automatically. Have you assigned a Content Template to the posts created by your Users? You can apply a single Content Template to all the posts in a single custom post type, if you have not already done so. Normally this is where you would insert the Edit Post Link shortcode, so that it is displayed automatically on all the posts. Then the User should see the link appear when they visit their post, then click that link, which will redirect them to a page containing the Edit Post Form, where they can edit the post.

and 3. is there information on this attachment to indicate those objectives have been met? or if not, in the creation of the content template, what check boxes should i be checking? they are filling out an attorney set of fields.
No, I can tell the objectives have not been met yet if you have not finished creating the template. In the creation of the content template, only check the checkbox "Don't assign to any post type", since you want an unassigned template. Then you will see a blank editor appear. This is where you insert the Edit Post Form. See below.

4. after having created the content template, how do i assign the already created form to it?
There's no assignment really, you just place the Edit Post Form in the empty, unassigned template. If you are using the Block Editor to design the template, you will place the Form using a Form block. If you are not using the Block Editor to design the template, you will place the Form by clicking the Toolset Forms button above the editor textarea and selecting the Edit Post Form you already created. A shortcode will be generated for you and inserted in the template. That's all there is to it.

#1650963
for-cred-form-content-template.png

i think i did as you said.
but as admin i published the post ( after adding some other details that did not appear in my permalink for the post)
logged out and went back to that post
did not see the edit button
did i goof on the shortcode ?
i did receive an email after i published it ( as admin)
did i need to register first
also i have hidden the backend login and come in with a different url
having users register means they are sent the url i use for the backend,
which is for me a security issue..

#1650973
statescounties-taxonomy.png
states-counties-not-checked.png

let's just say i drop the whole idea of trying to create an editable post from the author,
since i have both technical and security issues around this thing,
and just make sure required fields are there, which they are now.
When they fill out the CRED i look at their info before publishing.
But one of the things i have to do is to check off statescounties taxonomy, and Enter their Name
even though these are required fields, so somehow between their filling it out and my looking at it,
falls the shadow... i'd like to know how to make it happen automatically. see attached for sample shots.
if it is at all possible can you go behind the scenes and check it out?

#1651011

logged out and went back to that post
did not see the edit button
did i goof on the shortcode ?

1. You placed the edit post link shortcode in the same location as the Edit Post Form. If you click the Edit Post Link, it should load the template that contains the Edit Post Form. So you're effectively linking this template to itself, instead of showing the link in the post template where it should be. Remove the Edit Post Link shortcode from the for-cred-form-content-template.png template, there's no need for it here. Place the Edit Post Link shortcode in the template applied to the post, so when you visit the post on the front-end of the site you'll see the Edit Post Link. When you click the Edit Post Link, the template containing the Edit Post Form will be displayed.

2. The slug of the template that contains the Edit Post Form is not "template_for_editing_posts". The slug can be found at the top of the screenshot you just provided. You should copy the slug of this template and place it in the edit post link shortcode instead of "template_for_editing_posts". Either you wrote that slug manually or copied it without understanding what it does, or you chose the wrong template during the shortcode creation process. So you should either fix the slug by typing it manually, or use the Toolset Forms button above the editor to create a new shortcode and choose the correct template (the one shown in your recent screenshot). The system will generate the appropriate shortcode for you automatically.

#1651053
revised-edit-content-template.png

i removed the shortcode from the CRED Form
i have pasted the slug from the CRED Form to the shortcode,
now listed in the content template. see attached.
is this now correct? thanks for your patience!

#1652455
current-css-js.png
php-required-try.png

i have the original issue left, trying to make a field that appears in the CRED a required field.
other fields have no issue getting to be required by adding shortcode.

#1652765

My issue is resolved now. Thank you!

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