Home › Toolset Professional Support › [Resolved] Non Toolset relationship
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 |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Kolkata (GMT+05:30)
Tagged: Content-submission forms, Toolset Forms
Related documentation:
This topic contains 18 replies, has 2 voices.
Last updated by Minesh 5 years ago.
Assisted by: Minesh.
Hello
I have a CPT 'Person' and a user will only be allowed to create one 'Person' they then go on to create a CPT "Partner Page' and again will only be allowed to create one of these. The problem is that I need to pass some of the field values from one CPT to the other. So I follow theses steps
1. Create a single and unique CPT "Person' with fields a, b, c, d
2. Go to next page and create CPT 'Partner Page' which automatically fills in 2 of the fields with a and c from previously created CPT 'Person.
I shall look forward to hearing back from you
Regards
Geoff
Hello. Thank you for contacting the Toolset support.
As I understand - you are using Toolset Form to create new entry for CPT 'Person' and when you submit this form you want on next page where you added another form few entries should be automatically loaded. If this is correct - the approach you followed is correct.
Please check the following Doc:
=> https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
Hi Minesh
Good to hear from you again... Thanks for your help as always..
I understand the cred_field shortcode but I'm just not sure how to pass the information from one screen to the next so an example:
SCREEN 1
Create Person 1 - CPT 'Person' - Form
Name: James
Colour: Blue
Number: 88377773
SCREEN 2
Create CPT 'Partner Page'
Hat Size: (User inputs size)
Partner: (Name for CPT Person 1 from Screen 1 - i.e. James)
Partner's Colour: (Colour for CPT Person 1from Screen 1 - i.e. Blue)
Hope that makes sense..
Best regards
Geoff
Well - you can use the Toolset Fomr's redirection hook: cred_success_redirect
=> https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect
where you can add the redirection to your page and add your field values as URL param and use that URL param key with your another form field's urlparam attribute.
Please check the following related ticket:
=> https://toolset.com/forums/topic/url-parameter-value-is-not-set-for-the-field-inside-a-cred-form/#post-655270
Hi Minesh
Thank you for getting back to me...I understand how the cred_success_redirect could work to redirect to a new page but not sure how I would pass parameters from another post type and there is also a situation where I would want to create a CPT 'Partner Page' from just clicking on a link rather than from a form. So ideally I need some code that allows me to access the first created CPT 'Person' whenever they get to the create CPT 'Partner Page' Form..
I will attach a proper diagram of what I'm trying to achieve...
I also need to merge the first name and the surname from the CPT 'Person' into a hidden field on the create 'Person' page.
Hope that makes sense..
Best regards
Geoff
If you can create two page where you add two different forms and send me access details I would be happy to share the solution for you.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Hi Minesh
I'm still developing this area which is why I wanted your help before I make mistakes...any pointers would be great..obviously I'll get back in touch if I can't make it work..
Just some code hints for the functionality in the diagram would be fantastic please.
Hope you're doing good...
Speak soon
Geoff
Hi Minesh...
Ok I have been doing some work on this and have found some solutions..so lets start again from the beginning!
I have 3 problems:
1. When I'm in Access Control to set permissions for my various user roles for the various forms it will not save my changes.
2. I have a form with 3 fields - (first-name, surname and full-name) - When submitting the form I need for the full-name field to be automatically filled and saved with the first name and surname merged with a space between
e.g.
first-name: George
surname: Dawson
full-name: George Dawson
3. I have a CPT 'PERSON' that the user creates but can only create one of so - $person[0] I also have a CPT 'PARTNER PAGE' that again the user can only create one of so $partner_page[0]... When I go to the create 'PARTNER PAGE' or the edit 'PARTNER PAGE' I want the fields:
first name
surname
Automatically filled with the first name and surname fields from the CPT PERSON ($person[0])
I need to create some hook that retrieves the PERSON information whenever the create PARTNER PAGE or edit PARTNER page is called
I shall look forward to your response
Best regards
Geoff
New threads created by Minesh and linked to this one are listed below:
https://toolset.com/forums/topic/split-non-toolset-relationship-access-changes-not-saved/
I've split the ticket for questions 1 and 2. I will handle the original question you raised with this ticket that is the following question:
3. I have a CPT 'PERSON' that the user creates but can only create one of so - $person[0] I also have a CPT 'PARTNER PAGE' that again the user can only create one of so $partner_page[0]... When I go to the create 'PARTNER PAGE' or the edit 'PARTNER PAGE' I want the fields:
first name
surname
Automatically filled with the first name and surname fields from the CPT PERSON ($person[0])
I need to create some hook that retrieves the PERSON information whenever the create PARTNER PAGE or edit PARTNER page is called
===>
Can you please share the access details and problem URL where you added the form.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
Ok - but where I can access the first step? where did you add the first step form?
Hi Minesh
Ok I have removed your partner-page so you can go through the process.. the first step can be from one of two places. If you don't already have a CPT 'partner-page' then you would click on the 'invite my partner button on this page which will take you to the above mentioned page:
hidden link
if you have already created a partner-page by following the above step then you will want to edit the existing partner page by starting on this page:
hidden link
And clicking the '50% off for my partner' button which takes you to:
hidden link
This page has the edit form for the existing CPT partner-page (edit-content-partner-pages-1) - (ID: 12769) ..but again I need it automatically filled in with the first-name and surname of the users CPT Person with field 'Partner'='Yes' i.e. the first record [0]
To summarise on both these forms:
'Create content - Partner Pages 1' (ID: 2038)
'edit-content-partner-pages-1' - (ID: 12769)
I need the fields:
partner-first-name
partner-surname
filled with
'partner-first-name' filled with first-name(from CPT PERSON[0])
'partner-surname' filled with surname(from CPT PERSON[0])
Best regards
Geoff
Sorry Minesh..I forgot to add that in your case I have created your CPT 'PERSON' with field 'Partner=Yes' and given them the fields:
first-name: Sarah
surname: Jones
Regards
and thanks as always
Geoff
I've made little bit of changes. I've added the conditional statement you added outside the view's loop - I've moved it to inside the view's loop.
=> hidden link
As you can see now, I've passed the first_name and last-name as URL param with the invite-your-partner link as you can see below:
[wpv-conditional if="( '[get_user_role]' ne 'member' )"]<div class="buttonz-box"><a class="buttonz" href="<em><u>hidden link</u></em> field='first-name'][/types]&last_name=[types field='surname'][/types]">Invite Your Partner <span class="vc_icon_element-icon fa fa-arrow-right"> </span></a></div>[/wpv-conditional]
Now, when you click on "Invite Your Partner" button - it will catch the values passed to it based on the URL param first_name and last_name because - with the Toolset form:
=> hidden link
As you can see we added the URL param;
<div class="form-group"> <label>Partner's First Name</label> [cred_field field='partner-first-name' post='partner-page' value='' urlparam='first_name' class='form-control' output='bootstrap'] </div> <div class="form-group"> <label>Partner's Surname</label> [cred_field field='partner-surname' post='partner-page' value='' urlparam='last_name' class='form-control' output='bootstrap'] </div>
Hi Minesh
Ok great ..thank you.. So the first part works now passing the parameters from hidden link to hidden link
but now I need to click on the '50% off for my partner' button on the
hidden link
page
which takes you to:
hidden link
And the same thing has to happen here that the fields need to be filled in from the CPT 'PERSON' [0] with 'Partner' field = 'Yes'... but at the moment it defaults to the saved CPT 'partner-page' 'partner-first-name' and 'partner-surname' ---
so if I delete the existing PERSON here (hidden link) by clicking 'Remove Partner' and then click 'Add Partner' the Partner Page will still show the old name...so currently your partner is 'Sarah Jones' but if you remove her and create another called 'Sally Smith' (which will still be CPT PERSON[0] the edit form for your partner page (hidden link) will still be profiled with Sarah Jones:
So somehow we need to pull the fields from CPT PERSON[0] to pre fill the 'partner-page' edit form.
Hope that makes sense
Thank you!
Regards
Geoff
Let me review the whole flow and I'll get back to you as soon as possible tomorrow.