Skip Navigation

[Resolved] Possibility to create a date range as combination of Startdate and Fieldvalue

This support ticket is created 3 years, 10 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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by thomasB-2 3 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#1610265

We try to manage a company with it trainings with formidable. We have created a CPT "trainings" with the contents, description a.s.o. and try to manage the order process with a formidable forms - because Cred was more for handling / create new values in cpt, not for a classical form - or?.

These trainings are done once in a month, so we have a list of start-dates like these
03.06.2020
02.07.2020
06.08.2020
These Startdates are added as CPT with Relationsship, because one Startdateset could work for different Training

Also we have a Field value called "Number of Days" on every training.
And we try to get an additional field Value "Date Range", wich was calculated from both:
Sof if for training A the value in Number of Days= 3 the result in Date Range should calculate and show
03.06.-05.06.2020
02.07.-04.07.2020
06.08.-08.08.2020

Was that possible?

#1611743

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thank you for contacting us and I'd be happy to assist.

If your goal is to use a Toolset post add/edit form to calculate the Date Range, this will require some code customization.

For example, you can use "cred_save_data" hook ( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data ) to attach a custom function to form's submission that can read the values of start date and a number of days field and then populate and save the date range value, accordingly.

Useful links:
hidden link
hidden link

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/

regards,
Waqar

#1611773

Hi Waqar,

tnx for info - but it was not so, that User itself should add the Dates with Cred.
We add these values directly in the CPT Creation of the backend and the question was if it was possible to combine two fields to a new one.
Means Field Startdate (coming from Toolset Datepicker) and Fiels "Days (Numberfield) to a new field Daterange (as written on top).

#1613323

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thanks for writing back and for sharing further details.

If you'd like to do this automatic processing of two fields to get and save a value in a third field whenever a post is added/edited through the post edit screen in the admin area, you can use the "save_post" hook:
https://developer.wordpress.org/reference/hooks/save_post/

This should do the trick.

regards,
Waqar

#1618759

My issue is resolved now. Thank you!

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