Skip Navigation

[Resolved] Adding a Custom Field from Calendar Anything (or others)

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

Tagged: 

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 4 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#1921417
Screen-01.28.2021-Editproduct‹ServiceScheduler—WordPress-GoogleChrome.png
Screen-01.28.2021-Editproduct‹ServiceScheduler—WordPress-GoogleChrome.png

I am trying to get a custom field that was auto-created by the plugin Calendar Anything to appear in a ToolSet form. Unfortunately, the plugin does not see the Toolset custom fields nor does Toolset recognize the 4 that Calendar Anything created in the WooCommerce CPT.

Is there any documentation that you are following? hidden link

The date and time picker appear in the Woo Commerce backend (I've attached a screenshot). I'd like to have that box appear on a form or better yet, have the four different form fields be editable like others in Toolset.

In the meantime, I think if I just use the right input types, etc, and hard code it in Expert mode on a form it will work. I'm just confused. Assuming I wanted to just insure those 4 fields in between these two, what would I code, and would it work?

Here is the end of my Woo Form:

<div class="form-group">
<label>[cred_i18n name='views_woo_on_sale-label']Product On Sale Status[/cred_i18n]</label>
[cred_field field='views_woo_on_sale' force_type='field' class='form-control' output='bootstrap']
</div>
///INSERT Four new fields here
<div class="form-group">
<label>[cred_i18n name='views_woo_in_stock-label']Product In Stock Status[/cred_i18n]</label>
[cred_field field='views_woo_in_stock' force_type='field' class='form-control' output='bootstrap']
</div>
[cred_field field='form_submit' output='bootstrap' value='Submit' class='btn btn-primary btn-lg']
[/credform]

Better yet, could I use a better time picker? Here is some of the raw code that generates the form fields on the Woo products page.

<div class="cmb-row cmb-type-text-time cmb2-id-codemine-event-product-start-time" data-fieldtype="text_time">
<div class="cmb-th">
<label for="codemine_event_product_start_time">Event Start Time</label>
</div>
<div class="cmb-td">
<input type="text" class="cmb2-timepicker text-time hasDatepicker" name="codemine_event_product_start_time" id="codemine_event_product_start_time" value="" data-timepicker="{"timeFormat":"HH:mm:ss"}" data-hash="4itki3npth90">
<span class="cmb2-metabox-description">The time an event begins.</span>

</div>
</div>
<input type="text" class="cmb2-text-small cmb2-datepicker hasDatepicker" name="codemine_event_product_date" id="codemine_event_product_date" value="" data-hash="2qsembfahtdg" data-datepicker="{"dateFormat":"yy-mm-dd"}">

#1921465

Hello,

Unfortunately, Toolset Forms plugin does not support Calendar field of "Calendar Anything" plugin.

I don't think you can integrate those two plugins (Toolset Forms plugin and "Calendar Anything" plugin) easily, it might involve a lots of custom codes.

In Toolset side, Toolset Forms plugin supports custom date field, which stores value in timestamp format:
https://toolset.com/course-lesson/creating-custom-fields/
hidden link

If you need setup date range fields, you can setup two custom date fields:
- Start date
- End date

If you need multiple date range fields, you can consider these:
1) Create a child post type "Calendar", setup one-to-many relationship between "Product" and "Calendar"
https://toolset.com/course-lesson/how-to-set-up-post-relationships-in-wordpress/
2) Add those two custom date fields into "Calendar" post type:
- Start date
- End date

Then follow our document to setup the child post form for creating the child "Calendar" posts:
https://toolset.com/course-lesson/selecting-parent-posts-when-using-forms-to-create-child-items/

#1926445

I don't need anything in-depth and this is a rather newb question... but is it not possible to write to different databases on the same form in ToolSet (or any form for that matter)? The field below appears (plus 3 others) on the WooCommerce CPT so I would think I could simply hard code this on an existing ToolSet form in expert mode since it doesn't appear by default on the editor. Could I not just insert the code below to show that "Event Start Time field?

<div class="cmb-row cmb-type-text-time cmb2-id-codemine-event-product-start-time" data-fieldtype="text_time">
<div class="cmb-th">
<label for="codemine_event_product_start_time">Event Start Time</label>
</div>
<div class="cmb-td">
<input type="text" class="cmb2-timepicker text-time hasDatepicker" name="codemine_event_product_start_time" id="codemine_event_product_start_time" value="" data-timepicker="{"timeFormat":"HH:mm:ss"}" data-hash="4itki3npth90">
<span class="cmb2-metabox-description">The time an event begins.</span>

Again, if it's not possible and I'm not just not educated enough, a "no it can't be done" and (hopefully) a link to why so I can read more about it, especially if it's a general impossibility vs. a ToolSet limitation 😉

#1927261

You can try with action hook "cred_save_data", see our document:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
This hook allows doing a custom action when post data is saved to database.

And here is the document about: Toolset Hooks
https://toolset.com/documentation/programmer-reference/toolset-hooks/