TOPIC:

Start date, End Date response 8 months 1 week ago #238621

  • Topic Author
  • mrperfectpz
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 244
  • Thanks: 0
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'

Please Log in or Create an account to join the conversation.

Last edit: Post by mrperfectpz.

Start date, End Date response 8 months 3 days ago #238650

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 414
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

Please Log in or Create an account to join the conversation.

Start date, End Date response 8 months 2 days ago #238664

  • Topic Author
  • mrperfectpz
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 244
  • Thanks: 0
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"

Please Log in or Create an account to join the conversation.

Start date, End Date response 7 months 3 weeks ago #238753

  • Topic Author
  • mrperfectpz
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 244
  • Thanks: 0
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 ?

Please Log in or Create an account to join the conversation.

Start date, End Date response 7 months 3 weeks ago #238765

  • mihaela
  • Offline
  • Developer
  • Developer
  • Posts: 3128
  • Karma: 105
  • Thanks: 414
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

Please Log in or Create an account to join the conversation.

Start date, End Date response 7 months 3 weeks ago #238786

  • Topic Author
  • mrperfectpz
  • Offline
  • Expert Breezer
  • Expert Breezer
  • Posts: 244
  • Thanks: 0
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";}?>

Please Log in or Create an account to join the conversation.

Moderators: ForumSupport
Time to create page: 0.052 seconds

BreezingForms Pro 1.4.7 for WordPress Released!

Available in the membership section.

Summer Sale!

Massive discounts on all subscriptions!

Get Your Subscription Here

Quick Links

Downloads

BreezingForms

ContentBuilder

BreezingCommerce

Templates

Documentation

BreezingForms

ContentBuilder

BreezingCommerce

Apprendre BreezingForms (French Community)

Apprendre et maîtriser BreezingForms par des tutoriels et exemples, le tout en français

breezingforms.eddy-vh.com

Questions et réponses sur les forums de l'AFUJ

AFUJ

Special Offer

Summer Sale! All subscriptions at a special price!

Includes prio support, all of our current and future Joomla!® extensions and Joomla!® templates for the duration of your membership.

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!