Skip Navigation

[Resolved] Post Relationships and CRED form

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
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 4 replies, has 2 voices.

Last updated by PaulS4783 6 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1140267

Please take a look at this:
hidden link

I want the capability for users (via a CRED form) to add a House, select the City AND the State.

"State" of course is the parent of "City".

Is there a way to do this?

SUPPLEMENTARY QUESTION:
As you can see in the example above, the "Agent" field is a strict drop down select field, whereas the "City" field is auto-complete.
How can I determine what kind of input field?

#1140713

I want the capability for users (via a CRED form) to add a House, select the City AND the State.
If the post hierarchy is State > City > House like the real estate site, then there isn't a built-in way to do exactly this in Forms. You would have to create the State input field as a generic field, because there isn't a "grandparent" post relationship field built-in to Forms. Unfortunately then the automatically generated City field would not be tied to the generic State field...so all Cities would appear as options regardless of the selected State. To make this work really well would require a significant amount of custom code. We have more information about generic fields and the Forms API here:
https://toolset.com/documentation/user-guides/inserting-generic-fields-into-forms/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

the "Agent" field is a strict drop down select field, whereas the "City" field is auto-complete.
The "Agent" field shown in the Form represents a "select" type custom field, but the "City" field is not a custom field. City assigns a post relationship, which isn't exactly the same as a custom field. There is currently no way to create an auto-complete custom field, only a standard select type custom field. Post relationship inputs can be displayed with or without the auto-complete feature by applying different shortcode attributes in the Form.

#1140755

Thank you.
The first part of my question: yes, that's what I thought.
Just wanted to confirm.
Are there any plans to add "grandparent" relationships in the future?
That would be quite handy.

Post relationship inputs can be displayed with or without the auto-complete feature by applying different shortcode attributes in the Form.

Great. Can you point me towards the documentation for that?

#1141367

Are there any plans to add "grandparent" relationships in the future?
Not that I'm aware of, but I encourage you to submit a new ticket in the forum using the "Suggest an improvement" feature if you'd like to see this added. Our developers will evaluate your request and determine if it's something we can integrate.

Post relationship inputs can be displayed with or without the auto-complete feature by applying different shortcode attributes in the Form.
The attribute is use_select2 and the options are "always" or "never". You can also omit the attribute for the default behavior, which is standard select field if there are just a few options and auto-complete for more options (I think the threshold is 15 options).
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field

#1145611

You can close the ticket.