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.
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?
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.
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...
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.
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.
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).