Barbara Posted January 23, 2015 Report Share Posted January 23, 2015 How do I timestamp a record when value of a checkbox is changed? Quote Link to comment Share on other sites More sharing options...
bahar_vm Posted January 23, 2015 Report Share Posted January 23, 2015 Place the script below in the Footer of your details/update page. Status is my checkbox field. Change Status in the code to your field name. Time_status_edited is a hidden field to store the timestamp. Change Time_status_edited to your field name. ---------------------------------------------------------------function getT(){var prevValue='[@field:Status]';if(((prevValue!= 'Yes') && (document.getElementById("EditRecordStatus").checked)) || ((prevValue== 'Yes') && (!document.getElementById("EditRecordStatus").checked))) { document.getElementById("EditRecordTime_status_edited").value = '[@cb:Timestamp]'; }}document.getElementById("caspioform").onsubmit = getT;</script> Quote Link to comment Share on other sites More sharing options...
Jan Posted January 23, 2015 Report Share Posted January 23, 2015 Hi Barbara, Please do not forget the "<script>" before the code. The whole code will be: <script> function getT() { var prevValue='[@field:Status]'; if(((prevValue!= 'Yes') && (document.getElementById("EditRecordStatus").checked)) || ((prevValue== 'Yes') && (!document.getElementById("EditRecordStatus").checked))) { document.getElementById("EditRecordTime_status_edited").value = '[@cb:Timestamp]'; } } document.getElementById("caspioform").onsubmit = getT; </script> Quote Link to comment Share on other sites More sharing options...
Kurumi Posted February 18, 2019 Report Share Posted February 18, 2019 You could use the option 'Stamp on Update' on your Timestamp data type. Just like this: For more information about Data Types, check the article here: https://howto.caspio.com/tables-and-views/data-types/ I hope this helps! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.