Skip Navigation

[Resolved] Creating Prefilled Relationships in Post Forms

This support ticket is created 4 years, 4 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 15 replies, has 3 voices.

Last updated by Christian Cox 3 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1390323

Tell us what you are trying to do?

I have a "projects" type, and a "signups" type. Then I have a one-to-many Project Signups relationship.

I want people to be able to sign up to get information about a specific project. I want to create for instance a "sign up for Habit Installer" form that has a hidden field which links the new sign up automatically to the "Habit Installer" project. Then, when they get the notification email for the sign up, I want it to be prepopulated with the information about the project.

What is the link to your site?
hidden link

Here's an example of a form within a project where I want the signup to automatically create a relationship to the project, and pull in information for the email:
hidden link

#1390717

Hi, you can use the wpv-post-id shortcode to set the value of the parent selection field in the Form. Depending on where the Form is displayed, the syntax is a bit different. On the single Project post, you can use the $current_page operator. If you're using the drag-and-drop Form builder, open the post relationship field configurations and paste the following code in the value input field:

[wpv-post-id item="$current_page"]

If you're using the expert Form builder, you can paste the same code in the value attribute of the relationship field, something like this:

[cred_field field='@project-signup.parent' class='form-control' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="$current_page"]']

Then check the Form on the front-end of the site. The parent Project should be preselected. If you want to hide the field from the front-end User, add a CSS class "hide" to the input field:

[cred_field field='@project-signup.parent' class='form-control hide' output='bootstrap' select_text='--- not set ---' value='[wpv-post-id item="$current_page"]']

...then open the CSS panel and add this custom CSS code to hide the input:

.form-control.hide {
  display:none;
}

If the Form is not displayed on the single Project page, then you would have to pass in the Project ID some other way. I would need more information about where the Form is displayed.

Let me know if you have additional questions about this approach.

#1391295
Projects Signups Backend.png
Project Signups Frontend.png
Project Signups Frontend Showing.png
Project Signups Relationship Settings.png
List of Projects.png

I've tried your solution and it doesn't seem to work.

On the backend, I enter that information into the field. On the frontend, the field is not preselected- furthermore, when I select the dropdown, there are no options available. This despite the fact that I have a one to many relationship between projects and signups, and I have two published projects that should show to select. Pictures of the setup are attached.

#1391461

I can see some Javascript errors in the console on this page: hidden link
I've seen a ticket where a similar error was related to an outdated PHP version, another that was a compatibility issue with a specific theme. Can you add your site's debug information so I can take a look at some of your configurations? You can find instructions here: https://toolset.com/faq/provide-debug-information-faster-support/

I'll take a look and see if anything obvious sticks out, then give you some feedback.

#1391595

Here's my debug information

#1392517

Thanks, I don't see anything obviously suspect in your debug information. Can you try these troubleshooting steps?
- Temporarily switch to a default theme like Twenty Nineteen, then deactivate all plugins except Types, Views, and Forms. If this is a Commerce Form, please activate WooCommerce and Forms Commerce as well.
- If the Form does not appear on the site, add it to a draft Page so you can test the Form in a preview window
- Test the Form. If the problem is resolved, reactivate your theme and other plugins one by one until the problem returns
- If the problem is not resolved, I'll need to take a closer look.

Please let me know what you find out and we can go from there.

#1393939

Hey Christian,

It appears to be a conflict with the theme I'm using, One Tone Pro from MageeWP(hidden link)

#1397973

Okay thanks for running those tests. Since it's a paid theme, I don't have a copy available for testing purposes. Could I get admin login credentials for your site so I can log in and download a copy of that theme? I'll also check the theme options to see how yours is configured.

#1400883

Okay I was able to replicate this in my local environment by creating two CPTs in a one-to-many post relationship, then adding a new child post Form on the single parent post. The same JS errors are produced in my local tests, so this would seem to indicate a compatibility issue with the OneTone Pro theme. I've asked my 2nd tier team to investigate further. Do you have a direct email address available for this theme's developers? If our developers need to get in touch to collaborate on a solution, that will be helpful.

#1401013

The best email I have is their standard support email: support@mageewp.com

#1401025

Thank you very much, I'll pass that along and keep you posted here.

#1423785

Any updates?

#1426361

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Christian is on vacation. He will get back to work on the upcoming Sunday.

I checked the internal ticket but I do not see any update that I should share with you for now. Please hold on for further updates. Christian will get back to you as soon as possible.

#1430171

Thanks, as Minesh said there are no significant updates to report yet. I will keep you posted here as I receive new information.

#1645457

I seem to be unable to find a place to create new support tickets. Can you please point me to where I can create new tickets?

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