Date/Time/User Stamp on text box when notes added

Wish to see a specific feature/change in future releases? Feel free to post it here, and if it gets enough "likes", we'd definitely include it in future releases!
Post Reply
User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Date/Time/User Stamp on text box when notes added

Post by toconnell » 2013-11-08 19:09

It would be great if app gini could add a feature to the TEXT field option to drop in automatically a date, time and user name stamp to each note added to the text box.

Like NOTES in ACT.
Tina O'Connell
Web Dev & Appgini FAN

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Date/Time/User Stamp on text box when notes added

Post by AhmedBR » 2013-11-08 20:52

But wouldn´t this over grow your database?

I do this for the row, adding it to EACH field is like overdoing it, or am I missing something here?
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Date/Time/User Stamp on text box when notes added

Post by toconnell » 2013-11-14 16:32

Just to the text fields ONLY..


so the notes when a user clicks on the text box to enter text, it would automatically enter the date, time and the user name. It would be great!
Tina O'Connell
Web Dev & Appgini FAN

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Date/Time/User Stamp on text box when notes added

Post by AhmedBR » 2013-11-14 16:36

You mean like extra data in the field itself, if yes, you can do that from now, just use concat in the hooks (before insert) ;)
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Date/Time/User Stamp on text box when notes added

Post by toconnell » 2013-11-19 15:09

Can you elaborate on that.. how???

concat? What am I putting together?

Thanks, Tina
Tina O'Connell
Web Dev & Appgini FAN

AhmedBR
AppGini Super Hero
AppGini Super Hero
Posts: 327
Joined: 2013-09-19 10:23

Re: Date/Time/User Stamp on text box when notes added

Post by AhmedBR » 2013-11-19 18:02

Sure, here are the steps:

1. You get the member info using memberInfo array, examples are here:
http://www.bigprof.com/appgini/help/adv ... Info-array

2. and then use SQL date and time function to get date and time, here is some examples:
http://blog.sqlauthority.com/2007/06/21 ... te-fn-now/

3. concat the above info with the text in the field and replace using sql using the hooks.

That is the idea.
AppGini 22.14 - xampp 3.3.0 - PHP 7.4.30 - Summary reports - Calendar - Mass update - Messages - AppGiniHelper

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Date/Time/User Stamp on text box when notes added

Post by toconnell » 2013-12-05 20:40

AhmedBR wrote:Sure, here are the steps:

1. You get the member info using memberInfo array, examples are here:
http://www.bigprof.com/appgini/help/adv ... Info-array

2. and then use SQL date and time function to get date and time, here is some examples:
http://blog.sqlauthority.com/2007/06/21 ... te-fn-now/

3. concat the above info with the text in the field and replace using sql using the hooks.

That is the idea.
Just to make sure I would open my AppGini apx file and find the NOTES field in the table I want to put this in and under default content I enter

$memberInfo['username']:.' ' .CURRENT_TIMESTAMP and save and load? Or does this have to be done via the hooks..

if so.. would it be
Using the hook.. tablename_after_insert()
echo $memberInfo['username']:.'-'.CURRENT_TIMESTAMP

????
Tina O'Connell
Web Dev & Appgini FAN

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Date/Time/User Stamp on text box when notes added

Post by toconnell » 2014-02-05 15:52

The problem is that it only enters the date time and user id on the first notes entry.. when another user goes in and edits the note it does not enter their user id and time stamp..

Stuck and really need this.. I cannot seem to get people to type their initials and the date.. UG.. end users (frustrated with them LOL)
Tina O'Connell
Web Dev & Appgini FAN

primitive_man
AppGini Super Hero
AppGini Super Hero
Posts: 54
Joined: 2014-03-09 20:20

Re: Date/Time/User Stamp on text box when notes added

Post by primitive_man » 2014-10-29 19:59

I also had a requirement for this and came up with this solution:

NOTE:
date('Y-m-d G:i:s') gets Date-Time and outputs it in UNIX (MySQL) format.
Note that is the PHP date function which is dependent upon a lot of factors, including localisation, php server time etc - in order to get this information from a MySQL server, you'd have to connect to your database and use a 'SELECT CURRENT_TIMESTAMP();' query

This Hook adds a new line, the current username and current (php) Timestamp on insertion of new data - it can be used without alteration for updates.

function note_before_insert(&$data, $memberInfo, &$args){

$tim_stamp=date('Y-m-d G:i:s');
$updat = $data['note'].PHP_EOL;
$data['note'] = $updat.''.$memberInfo['username'].' - '.$tim_stamp;

return TRUE;
}

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Date/Time/User Stamp on text box when notes added

Post by toconnell » 2015-01-05 13:57

Thank you.. trying now. I will let you know.

Thanks,
Tina
Tina O'Connell
Web Dev & Appgini FAN

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Date/Time/User Stamp on text box when notes added

Post by toconnell » 2015-01-05 14:00

Primitive man.. "note" is the name of your note field, or text field?

Thanks, Tina
Tina O'Connell
Web Dev & Appgini FAN

User avatar
toconnell
Veteran Member
Posts: 204
Joined: 2013-04-09 19:29
Location: Oklahoma City, OK
Contact:

Re: Date/Time/User Stamp on text box when notes added

Post by toconnell » 2015-01-05 14:21

Just tried it.. no good. I changed the field name note to notes but other than that it was copy and paste of the code.. tested first in the before update function of the hook, then tried after update, unfortunately neither test worked.

Thanks.. any suggestions?
Tina O'Connell
Web Dev & Appgini FAN

User avatar
shasta59
AppGini Super Hero
AppGini Super Hero
Posts: 231
Joined: 2013-01-08 19:40
Location: Calgary, Alberta, Canada

Re: Date/Time/User Stamp on text box when notes added

Post by shasta59 » 2015-01-09 02:18

I am working on a method to do this when the person leaves the text box to go to another field it will automatically put it in (date, time). If they add more notes they can delete the previous date/time etc. I am not doing this with hooks but rather putting code in to do it directly. Adding functions etc to extend appgini generated code. Find this way is more interactive then waiting for a hook to put the data in as the feedback is immediate to the user.

I will be using event triggers to do this. I have also played with having it recognize when you re-enter a field (and have not saved the record yet) and ask if you wish the previous date/time deleted before you enter more notes so only one date/time is in place for that particular save event.

This will all be done with javascript etc. This is a back burner project so it will not be posted here for a while. When it is done and working 100% I will post it. I have too many irons in the fire right now to finish this past the play around stage. (This means it works 75% of the time and the rest of the time messes things up a lot - :lol: )

I am currently working on a better auto log out system that will also recognize when you are doing something and reset the timer.

Alan
Calgary, Alberta, Canada - Using Appgini 5.50 -

Post Reply