Page 1 of 1
Date/Time/User Stamp on text box when notes added
Posted: 2013-11-08 19:09
by toconnell
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.
Re: Date/Time/User Stamp on text box when notes added
Posted: 2013-11-08 20:52
by AhmedBR
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?
Re: Date/Time/User Stamp on text box when notes added
Posted: 2013-11-14 16:32
by toconnell
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!
Re: Date/Time/User Stamp on text box when notes added
Posted: 2013-11-14 16:36
by AhmedBR
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)

Re: Date/Time/User Stamp on text box when notes added
Posted: 2013-11-19 15:09
by toconnell
Can you elaborate on that.. how???
concat? What am I putting together?
Thanks, Tina
Re: Date/Time/User Stamp on text box when notes added
Posted: 2013-11-19 18:02
by AhmedBR
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.
Re: Date/Time/User Stamp on text box when notes added
Posted: 2013-12-05 20:40
by toconnell
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
????
Re: Date/Time/User Stamp on text box when notes added
Posted: 2014-02-05 15:52
by toconnell
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)
Re: Date/Time/User Stamp on text box when notes added
Posted: 2014-10-29 19:59
by primitive_man
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;
}
Re: Date/Time/User Stamp on text box when notes added
Posted: 2015-01-05 13:57
by toconnell
Thank you.. trying now. I will let you know.
Thanks,
Tina
Re: Date/Time/User Stamp on text box when notes added
Posted: 2015-01-05 14:00
by toconnell
Primitive man.. "note" is the name of your note field, or text field?
Thanks, Tina
Re: Date/Time/User Stamp on text box when notes added
Posted: 2015-01-05 14:21
by toconnell
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?
Re: Date/Time/User Stamp on text box when notes added
Posted: 2015-01-09 02:18
by shasta59
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 -

)
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