Skip Navigation

[Resolved] How can I use repeatable fields and other fields in the same post cred form?

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

Problem: How can I use repeatable fields and other fields in the same post CRED form?

Solution: It's not currently possible to edit a post's fields and repeating fields in the same CRED form. Instead, you must create a separate form just for the repeating field group.

100% of people find this useful.

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.

Tagged: 

This topic contains 15 replies, has 2 voices.

Last updated by ErdemD1542 3 years, 5 months ago.

Assigned support staff: Christian Cox.

Author
Posts
#630504

Tell us what you are trying to do?
Hi;
Firstly, I couldn't understand why we have to create two forms when we need repeatable fields. Maybe, I missed something.
(One for normal post one for repetable fields). Can stable version of type 3 new features handle this ?

I want to use all post fields (also repetable fields) in a single form . Also this one is important for to edit posts.
There's a warning as " Form type and post type do not match" when I want to edit repatable fields .

Thanks

#630592

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

It's not possible to edit the post's custom fields and the post's repeating field groups in the same form yet. The CRED beta is still a work-in-progress, and, I agree, the process is not very intuitive right now. We're working on a way to streamline this process and support nested repeating field groups in CRED, and the best place to follow along with our M2M progress is our blog: https://toolset.com/blog

#630608
a0.png

I look forward to see updates since type 3 announced.
Also , please consider that all parent posts are avaiable to select on repatable cred forms.. I can't limit the posts to select according to author of post. user should see only his own post.
Thanks

#630664

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

As far as selecting the parent post, if you do not want to give your site users the ability to select a parent, you can use the "value" shortcode attribute to preset the parent post ID. You can then hide this input field from the front-end using a hidden div or some other CSS. Here's an example, where the CRED form is placed on the parent single post:

<div style="display:none;">
  [cred_field field='@book-chapter.parent'  value='[wpv-post-id id="$current_page"]' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>
#630670

Sorry Christian, something misunderstood. You I know I can't use all fields in the same form. So I decided to use cred forms like multi step form.(Post cred forms goes to repeateble cred form page after published )I use cred form (repeatable fields) with shortcode on a page . So post id option doesn't work.
Default is; every user's post shown to everyone. I just need to show user own posts(@parent) to user.

Thanks

#630694

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I understand, but this is the only option I know of that does not require significant custom code. The original form must redirect to the new post, and the repeating field group form must be included on the new post page. Otherwise, you can use custom code to modify the redirection URL, include a URL parameter that refers to the parent post's ID like yoursite.com/create-repeating-fields-redirect-page/?parentid=12345. Then read that URL parameter value and insert it in the parent post CRED field.

Here is the redirect manipulation API:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

Here is a custom shortcode that lets you access URL parameters:

add_shortcode( 'wpv-post-param', 'wpv_post_param_shortcode' );

function wpv_post_param_shortcode( $atts ) {
  if ( !empty( $atts['var'] ) ) {
    $var = (array)$_GET[$atts['var']];
    return esc_html( implode( ', ', $var ) );
  }
}

Use it like this:

<div style="display:none;">
  [cred_field field='@book-chapter.parent'  value='[wpv-post-param var="parentid"]' select_text='--- not set ---' class='form-control' output='bootstrap']
</div>
#631195
a3.png

Hi Christian,
Every user reach every users post at select gadget area without your codes.
I've followed your directions.
Code added to function.php, shortcode added to toolset setting. Custom toolset code aaded to repeatable cred form.
"display:none" hide field area.

You may see here: hidden link

Unfortunately, no result.

Thanks...

#631201

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Screen Shot 2018-04-03 at 4.58.51 PM.png

I'm unable to access that shortened URL, sorry. I see the following error:
https://goo.gl/2z62UK – this goo.gl shortlink has been disabled. It was found to be violating our Terms of Service. Click here and here for more information about our terms and policies respectively.

#631203

It's the same as screenshot. I can give you an admin pass to see. Google short link was for making link hidden.( Project Web Site)

#631214

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Any link text you share publicly in the forum is hidden so only you and Toolset supporters can see it. I need the full URL including the parent post ID parameter I mentioned before:

like yoursite.com/create-repeating-fields-redirect-page/?parentid=12345

#631215

Here's the link
hidden link
Thanks

#631221

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Please provide login credentials in the private reply fields here.

#631551

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

I see two things:
1. The URL parameter is parentid=243, but there is no Gadget with ID 243. ID 243 is the page "Repetable Zone". This isn't quite right, because the parentid must be the Gadget ID, not the ID of the current Page. You must modify the URL parameter to match the parent Gadget ID.

2. The wpv-post-param var value should not be a hard-coded number like 243, it should be "parentid", like this:

[cred_field field='@repeatable-zone.parent'  value='[wpv-post-param var="parentid"]' select_text='--- not set ---' class='form-control' output='bootstrap']

This will let you pass the Gadget ID into the URL parameter.

#631582

I'm really confused. Codes are revised as you mentioned. But nothing changed.
I think I couldn't explain what I need.My mistake.
I don't want to hide gadget parent select option.It hides dropdown field even /?parentid=10 extension added to link.
I just want only users own gadgets shown at dropdown on cred form on repeatable zone page.So users will add repetable features to their gadget not other's gadget . They'll use this page hidden link.

Thanks

#631970

Christian Cox
Supporter

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Unfortunately there is not a good way to filter those parent options yet, so all parent options will be displayed. We're working on a way to expand the options here. The alternative I tried to explain is to create a View of Gadgets filtered by post author (the current User), and include a link to the Repeatable Zone for each Gadget. Something like this:

My Gadget 1 | Add Repeatable Zone (links to URL like repetable-zone?parentid=12345)
My Gadget 2 | Add Repeatable Zone (links to URL like repetable-zone?parentid=67890)
My Gadget 3 | Add Repeatable Zone (links to URL like repetable-zone?parentid=43210)
...and so on...

Then place this list of Gadgets somewhere on your site. Do not link to the repetable-zone page directly in your site menu, only link to it in the list above.

Another option is to include the CRED form directly on the Gadget single page, and this eliminates the need for a special link and URL parameter.