Skip Navigation

[Resolved] custom field type of form

This support ticket is created 2 years, 11 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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)

Author
Posts
#2066227

Tell us what you are trying to do?
The easiest example to explain what I am trying to do is - the discover-wp tutors sample site which is great display of the kadence blocks integration with toolset but seems to be lacking a way to book or even send a context aware form to the the tutor.

I am trying to build something very similar but the sticking point is there seems to be no way to add a custom field which is a form, although there is a custom field which is a post reference.

https://toolset.com/course-lesson/creating-custom-fields/
https://toolset.com/course-lesson/using-post-reference-field-to-set-up-one-to-many-relationships/

Is there a similar example that we can see?
functionally it would work like this https://wordpress.org/plugins/acf-gravityforms-add-on/ (but using toolset forms of course)
In many cases we cannot use toolset blocks to build the post template but I can always use custom fields as the dynamic data for Oxygen builder for example.

Mostly I am curious if I missed something.... it feels like it should be easy to do but I can't find anything, and all the examples I found on discover-wp lead us down a logical path to either book or request or register.., but then nothing ! .... it feels like either something is missing or I am missing something obvious !

Both Tutors and C&B properties.... I am continuing to look.

cheers

btw I looked at created a form to populate the post....

#2066755
Screen Shot 2021-05-24 at 2.03.18 PM.png

Hi, you are correct in that there is no "form" type custom field in Types, but you can insert a Toolset Form in a WYSIWYG or multiline text custom field using a shortcode, then implement that custom field elsewhere on the site in a dynamic way. Insert a Form by title like so:

[cred_form form="Your Form Title"]

The Forms shortcode documentation has details about the syntax and other implementation variations:
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/

If you explain a bit more about what you mean by a context-aware form, I might be able to provide some additional guidance. For example, you can use generic hidden fields in Forms to capture the post ID of the post where the Form is displayed. That's one way Forms can provide access to the context in which the Form was submitted. That contextual information could then be available in an email notification for this Form, or in a Forms API callback for this Form submission, etc. I'd need more information about what exactly you want to accomplish to be able to give you better advice here.

Another way would be to implement a post relationship between the post type created by the Form and the post type of the post or page where the Form is displayed. For example, say the Form is displayed in the template for post type "A" and is configured to create posts in post type "B". If you have a one-to-many (O2M) post relationship set up between CPT A (parent) and CPT B (child), then you can configure the Form to create child posts by automatically linking the new post being created and the post where the Form is displayed, in this O2M relationship. You can enable this automation by either using the "Create child post link" feature, or by applying specific settings in the child post Form. The "Create child post link" is simpler to implement, but the workflow requires you to display the child post Form on a page that is separate from the parent post. This feature is described in the doc here: https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/

In an alternate child post creation workflow, the child post Form is displayed directly in the parent post template. This setup requires a bit of code in the Form's relationship field configurations. Set the default value of this field using a post ID shortcode, pointing at the current page as the source of the post ID. This shortcode will produce the ID of the post where the Form is being displayed, so adding it as the default value of the post relationship field will result in the current page being selected as parent automatically.

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

Screenshot attached here showing this configuration in the Form builder. You can also add some custom CSS in this case if you want to hide the relationship select field for a more intuitive experience. See our documentation about this shortcode and the "item" attribute:
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-id
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/item-attribute/

#2067079

Christian,

thank you for such a substantial reply...

I think you answered the content aware bit, by which I merely meant that the form is aware of the post in which is is displaying and therefore can use some of those fields in a notification.

e.g. if the post was titled

seminar name: Wombat Awareness
date: May 30, 2021
time: 21:00
presenter: Wally Wombat

The form notification can get that dynamic data from the post, to send in the confirmation - rather than having a seperate form per post.

I am more used to gravity forms for this sort of this so It might take me a couple of days to get my head around the differences and make an update

In the meantime I just wanted to say thank you for taking the time to explain. If we can leave this ticket open for a few days I will post here the result .

cheers

#2067129

Of course, I'm glad to help educate on the features here. I have set the ticket status pending your update, and I will stand by for your update. You will be prompted with email notifications before the thread closes automatically.

#2071941
Screen Shot 2021-05-30 at 20.58.53.png

Christian,

thanks you explanation made me realise I was taking the long way and so I simply added

[tb-calendar coworker="[wpv-post-author format='meta' meta='ID']

as a single line custom field default value, then added the single field using blocks and an additional kadence tab.

It works well where the Post author = the person being 'booked'.

tb-calendar just an example I use, I imagine any booking plugin which can accept the author ID as a parameter to map the bookable person could use this method.

thanks again

#2072813

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Bryan,

Christian is current on vacation at this time, however reading through this ticket it would appear that the issue has been resolved.

If there are further queries please let me know. If not then you can go ahead and mark this ticket as resolved.

Thanks,
Shane

#2073015

Thanks Shane - as always much appreciated

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