Skip Navigation

[Resolved] Display Form Conditional to Date on Parent post

This thread is resolved. Here is a description of the problem and solution.

Problem:
Display Form Conditional to Date on Parent post

Solution:
You can use [wpv-conditional] shortcode with "TODAY()" function to check the custom date field aginst current date value.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/display-form-conditional-to-date-on-parent-post/#post-1138157

Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

This support ticket is created 6 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 8 replies, has 3 voices.

Last updated by alexanderv-5 6 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1135727

I am trying to:

I am trying to make the visibility of a form conditional by the date (custom field) of the parent post.
Using the conditional system itself is great but i may write the code wrong.

So far i have tried it many ways and i came up with this so far:
[cred_show_group if="( $(event-date.parent) gte TODAY() )" mode="fade-slide"]

The "event-date" is a date from the parent custom post.

So far it has not worked, i think i need to write it differently.

I spend a day on this but can't find a solution. Sorry can you help me?

#1136031

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - there is no way to compare the parent field with [cred_show_group ] shortcode as its not supported natively but if you agree I can take it as a new feature request.

#1136154

So, there is no way to make a conditional display of a form that is comparing the TODAY() condition to a custom Date field on the page it is displayed?

I want to achieve that this "Event submission Form" is automatically not available after the "Date of the Event" has passed. It will spare me and my coworkers a lot of time.

If i may ask you, do you have any idea how to achieve this without the direct comparison to the parent page?

For example, I already have a parent relationship in the form by using "@RELATIONSHIP-SLUG.parent " that helped my automatically create a relationship with the page the form is displayed. (Thanks to annother supporter from toolset) In the same manner, can the custom Date field not be seen and compared for a conditional display?

If it is not possible in any way, yes it would be great if a request could be made. Thank you for your time.

#1136569

Minesh
Supporter

Languages: English (English )

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

I want to achieve that this "Event submission Form" is automatically not available after the "Date of the Event" has passed. It will spare me and my coworkers a lot of time.
==> Well - for that you should use a content template where you should add [wpv-conditional] shortcode and add your conditional check. I would like to know here is "Date of the Event" field is created using Types?

Can you share problem URL where you added the form?

I have set the next reply to private which means only you and I have access to it.

#1137515

Hi,

Minesh isn't available, he has one day vacation, you will get the response ASAP when he back on Thursday.

#1138157

Minesh
Supporter

Languages: English (English )

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

Well - I didnt knew that you were using Elementor.

What if you try to use following code to check your event post date conditionally within your form:

[wpv-conditional if="( '[types field='datum-des-events' output='raw'][/types]' lte 'TODAY()' )" debug="true"]

the event date is less than or equal to Today.

[/wpv-conditional]

Please feel free to change condition as per your requirement. Currently its set to less than or equal to.

#1138887

Thank you for the suggestion.

But at the moment I can't do anything. Every time I go into the form I want to change a message comes up and says that the "toolset support" (Your user handle) has taken over and is in the process to edit.

I don't know if this is a bug or if it is still you in there trying things.

#1138888

Minesh
Supporter

Languages: English (English )

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

Ok - I just logged out from the site. You will be able to edit your form now.

#1138924

Thank you! Now it works, and it will help me with other form conditions I have to amend in the same way.

Learned a lot thanks to this problem.

One Last Thing. The Elementor template was bugged after we both worked on it, it wouldn't save.

So I created a new template and entered the form into it. Works fine now. Maybe there is a small bug there with the access restriction.

But Anyway. I much appreciate the help and now I can finally design the rest of the homepage and get started with content.

Have a good day.