Start date, End Date response

  • mrperfectpz
  • Topic Author
  • Away
  • Expert Boarder
  • Expert Boarder
  • Posts: 83
  • Thank you received: 0

mrperfectpz created the topic: Start date, End Date response

Hi

Firstly, I must congratulate you all for your great work !!!

In contentbuilder is there a way to check that the current date (today) is within a start date and end date and give an 'active' response , else 'inactive'
#238621
  • Posts: 2993
  • Karma: 104
  • Thank you received: 394

mihaela replied the topic: Start date, End Date response

Hello,

If you mean that it is looped through the records and only records for which that day's date is between the start and end date, unfortunately, that is not a default ContentBuilder feature.

Here is a piece of documentation crosstec.org/en/support/online-documenta...r-joomla-%C2%AE.html explaining an advanced ContentBuilder search module.

I'm sending you this so you can see whether it could help you with your requirements.

Regards,

Mihaela
#238650
  • mrperfectpz
  • Topic Author
  • Away
  • Expert Boarder
  • Expert Boarder
  • Posts: 83
  • Thank you received: 0

mrperfectpz replied the topic: Start date, End Date response

No not really, I will give some more information to help.

I have a 3 fields, 'startdate', 'enddate' and 'status'. In list view can I place some code into list wrap code to check against todays date. If 'startdate' is after todays date the 'status'="PENDING", if before todays date then 'status'="IN PROGRESS", also check 'enddate' and if before todays date the 'status'="COMPLETE"
#238664
  • mrperfectpz
  • Topic Author
  • Away
  • Expert Boarder
  • Expert Boarder
  • Posts: 83
  • Thank you received: 0

mrperfectpz replied the topic: Start date, End Date response

Could I get the calendar dates entered if the bf form from the database and run it through the item wrap code to check against todays date, if yes how can I get the values from the database ?
#238753
  • Posts: 2993
  • Karma: 104
  • Thank you received: 394

mihaela replied the topic: Start date, End Date response

Hello,

I will give you instructions on how to change the "status" field in BreezingForms if user enters a certain record, in order to edit it.

Go to the Advanced properties of the "status" field and in the "Initscript" section set Type to "Custom" and check the "Page Entry" checkbox.

In the code area below put this code:
function ff_status_init(element, condition)
{
    var start = ff_getElementByName('startdate').value;
    var end = ff_getElementByName('enddate').value; 
    var today =  new Date().toISOString().slice(0,10); 

    if( today < start )  element.value = "PENDING";   
    if( today >= start && today <= end )  element.value = "IN PROGRESS";   
    if( today > end)  element.value = "COMPLETE";   

} // ff_status_init
That is it. So, this will change the value of the "status" filed if user enters a certain record to edit it.

Next what can be done is you could add Item Wrap Code that would for each record compare today's date with startdate and enddate and change the value in the "status" column accordingly.
NOTE: This will not actually change the value of "status" field in the record, but the wanted status will be visible in the list view where all records are displayed.

Go to the "Item wrap code" of the "status" field in the list view and put there this code:
<?php $start = 'col13330'; $end = 'col13331'; if( date("Y-m-d") < $item->$start ){$value="PENDING";} if( date("Y-m-d") >= $item->$start && date("Y-m-d")<= $item->$end ){$value="IN PROGRESS";} if( date("Y-m-d") > $item->$end ){$value="COMPLETE";}?>
NOTE: Replace 'col13330' and 'col13331' with the ID's of the startdate and enddate columns in your view.

That will show the status in the list view as you wanted.

Let me know whether this is working as you wanted.

Regards,

Mihaela
#238765
  • mrperfectpz
  • Topic Author
  • Away
  • Expert Boarder
  • Expert Boarder
  • Posts: 83
  • Thank you received: 0

mrperfectpz replied the topic: Start date, End Date response

Unfortunately it doesnt seem to work. I entered your code into the item code wrap as you instructed however it renders all as "COMPLETED". This is the code I entered. I changed your 'col13330' and 'col13331' to the ID 's.

<?php $start = 'col124'; $end = 'col119'; if( date("Y-m-d") < $item->$start ){$value="PENDING";} if( date("Y-m-d") >= $item->$start && date("Y-m-d")<= $item->$end ){$value="IN PROGRESS";} if( date("Y-m-d") > $item->$end ){$value="COMPLETE";}?>
#238786
Moderators: ForumSupporttomeperica
Time to create page: 0.079 seconds

New Icon Packs Category!

Crosstec is now offering icon packs.

If you are a paying subscriber, icon packs are automatically added to your account.

Check out our icon packs page!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Summer Sale!

50% discount on all of our extension subscription plans, templates and icon packs!

Get Your Subscription Here

News and Updates

Get informed about new downloads, updates and more in our News and Updates newsletter.

All Extensions Subscription

Get 1 year access to all of our current and future products and 1 year of professional support -- 99 for just 49! (Summer Sale)

No support per domain or website installation limits! Includes all of our current and future Joomla!® extensions, Joomla!® templates for the duration of your membership. This means, by purchasing an All Extensions Subscription you'll have it all covered!

Get it from here

3rd Party Discount - 25% Off

We help you to keep your costs under control. If you are a new member and purchased a form building tool from a different form vendor, then you'll get a 25% discount on our subscription plans.

How to receive the discount:

Send us a quick email to sales@crosstec.org with a proof of purchase (for example a paypal receipt), await payment instructions and enjoy your membership!

Live Support Chat Opened!

Join our Discord chat here to receive live support and talk directly to the team!

Community Reward

Help us to create new extensions and plugins! With only $5 you help us a lot and get unlimited download access to all of our products, professional support and even more. Get your reward now!

Read More Here