How can I set a field to automatically store the date and time when a progress bar reaches 100% but to stop changing. I currently have a code field cb_jumpstart_completed_step3 where I want to store the timestamp of when the progress bar cb_change_plan_points_bar reaches 100% (using CB Core Fields Ajax Update on cb_change_plan_points_bar). This is the code:
if ( [cb_change_plan_points_bar] == "100" and $cb_jumpstart_completed_step3 == "") { return $datetime1; }
else { return $datetime2; }
It works fine until cb_change_plan_points_bar reaches 100%. However, after 100% has been reached, every time I refresh the profile page the timestamp changes to the current time. I would really appreciate your help with this.
I'm guessing you're using Update On on a Code field? Code fields have no storage. You need a place to store the timestamp. Code fields just take your PHP, execute it, and display the results. What you'll likely need is to use CB Auto Actions to store the timestamp to a datetime field.
Global
Triggers: onAfterUserUpdate
Type: Field
User: Automatic
Access: Everybody Conditions
1: [cb_change_plan_points_bar] Equal To 100
2: [cb_jumpstart_completed_step3] Equal To 0000-00-00 00:00:00 Action
Field: cb_jumpstart_completed_step3 (I assume this is a datetime field)
Value: [cb:date format="Y-m-d H:i:s" /]
Translate Value: No
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.