Skip Navigation

[Resolved] CRED Parent Post Selector is not populated correctly

This support ticket is created 6 years, 1 month 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 9 replies, has 2 voices.

Last updated by ScottM9386 6 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1128468

Hi,

Parent Post Selector is not populated correctly
- or maybe I'm just missing something.
I saw this but I don't think it applies to my situation.
https://toolset.com/errata/cred-parent-post-selector-is-not-populated-correctly-if-parent-post-id-is-passed-in-url-parameter-parent_post_id/

CPT's
track
writer
in a many to many relationship.

Forms:
track - edit existing content
track-writer relationship form.

the track page contains the "edit existing content" form to edit the track.
there I insert [cred_child_link_form form='451' parent_id='-1' text='Create new' target='_top']

but the Parent Post Selector is not populated in the track-writer form.

am I doing something wrong?

Thank you!
Scott.

#1128876

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Scott

The debug info is missing your plugins for some reason, but I assume we are talking about Types 3 many-to-many relationships here.

It can be confusing creating relationship forms, so I just went through the steps again to remind myself and confirm it is currently working as expected.

The thing that jumps out at me is that the shortcode you describe—cred_child_link_form—is not what I'd expect to see.

I have understood you to want to be able to link to a relationship form which connects an existing writer post to the current displayed track post, is that correct?

For that I followed the steps described here: https://toolset.com/documentation/post-relationships/how-to-build-front-end-forms-for-connecting-posts/#our-example-songs-and-albums

It is the second example that I used, namely "Add a song to a specific album".

So I first created a relationship form, following the wizard and indicating that the form was to connect an existing right post to the current left post.

I then inserted this form into a Content Template (unassigned).

I then edited the template for single left posts (tracks, in your case), and used the Toolset Forms button to insert a relationship link. I followed the wizard (and had to again specify that the form was to connect an existing right post to the current left post), which inserted the following shortcode:

[cred-relationship-form-link form='connect-right-to-left' parent_item='$current' content_template_slug='connect-right-to-left-form']Connect another Right[/cred-relationship-form-link]

Clearly you have done something different because you ended up with a different shortcode.

Or did I misunderstand what you aim to do?

#1129299

Beautiful!
Thank you!
I was using, under forms, "Other Toolset Forms actions - Create Child Post Link".
So, just a couple more questions.

1. I actually put this link ("cred-relationship-form-link") in my "edit post form" (which edits the track and is the layout for CPT tracks) - I'm assuming this is OK? it works. there is no option to get to that window (inserting forms) from within forms, so wasn't sure it was OK - but as I say it works. I did this 'cause I have the fields in the form in tabs using the "tabby tabs" plugin...there's just so many fields I needed to divide it up, and I have a tab "writers"

2. I really wish I could change the name of the relationship "submit" button as one can with post forms.
is this possible? will it be possible at some point at in the future?

3. what is the "Create Child Post Link"

I have to update the toolset plugins manually 'cause I get an error when trying the usual way "update failed:undefined" something like that - maybe that's why plugin info isn't showing in debug?
I haven't updated yet.
anyway - my current types version is 3 something...

Thank you!

Scott.

#1129301

one more question please...
is there anyway to change the default text in the child selector.
currently it says "search for a post"

thanks!

#1129320

sorry - another question...

even though I have the relationship form set to "stay on same page" after submit, it takes me back to the "track" page.
any ideas?

thanks.

#1129327

I have another relationship form question - but it's a different form from the one under discussion...do I need to open another tx?

basically...
in this relationship form - if submission is set to Ajax there's no spinner. how can I add?

thank you!

#1129716

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Scott

You have quite a few questions, let me see if I can quickly address them:

1. adding the link to the relationship form inside the post edit form
Never tried it. With HTML you cannot nest forms, but you are not actually doing that, you are adding a link to another form within the first form. Clicking the link will take you out of the first form and load the second form. The fact that the second form works—it understands the context it came from—I would say is by accident more than by design, because the edit form is shown at the same URL as the post being edited.

2. change the name of the relationship "submit" button
It doesn't seem to be documented, but you can add a label attribute with the text of your choice to the cred-form-submit shortcode.

3. what is the "Create Child Post Link"
With parent-child relationships when you have a form to publish child posts, you can add a link to that form on the template for parents so that, when clicked, the child form knows which parent the children should belong to.

4. change the "Search for a post" text
It appears to be hard-coded (although translatable) without the option to modify. I'll split this thread to create a request.

5. redirecting when should stay on same page
I don't get that on my test site. I suspect it may be because of 1. above. Can you test adding the link to the post itself and not the edit form?

6. add spinner to relationship form ajax requests
I think this needs to be a feature request. I tested, simulating a slow 3G network. Because this is an ajax request with a pretty small payload, even then the update happened quickly, and so I doubt a spinner would be needed in many cases unless there was a network problem. Let me know if you want me to create a request.

#1130005

Hi Nigel,

Wow! Thank you and sorry for all the questions!
#2. Label attribute for submit button - great! they should document that - I scoured the web for that...
#5. will test
#6. add spinner - not a big deal - the one thing I like about how the relationship form handles Ajax as opposed to the post form is it doesn't reload the page so all the intermediary fields stay filled out, which makes it easy for the user to add another relationship connection with the same data in the intermediary fields - which for my users would be a huge benefit.
Unfortunately with the post form (which has spinner) Ajax reloads the page and clears all the fields....I wish it wouldn't do that.

My ideal for both post forms and relationship forms is have a spinner but not reload page and not clear the fields - maybe I need to get someone to code this for me. A "track" of music could have many versions (full mix, drums and bass, etc.) but all versions would have many of the same fields.

Thank you!!
Scott.

#1130609

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Scott

About #6, I had a quick chat with the developer who said that there were reasons the relationships forms worked differently to the normal post/user forms, and while we may update the standard post forms to work more like current relationship forms at some point, it won't be happening for the foreseeable future, as Forms already has quite a lot on the development plate (there will be some interesting updates over the next few months).

Let me know about #5.

#1135452

Thank you!