Buy Now
Sign in

Save last username that modifies data

angelmorales , December 29 2020, 00:06
angelmorales 150
December 29 2020, 00:06 #395523
Hello, well , I can retrive the username that its logged in, so I want to save that username to my table everytime the form its saved.
In the section On Load I put a Custome code with this:
$user =& JFactory::getUser();
$form->data['name'] =& $user->name;
Then I put in the Designer a textbox (name) and the username displays there everytime the Form its loaded, everthing works fine so far.
Then I create a new column in my table= "name" so when the form its saved the username saves there.
But it doesnt work , form saves everything except the username
Please help!
GreyHead 65
December 31 2020, 10:53 #395538
Hi angelmorales,
I suggest that you temporarily enable the Debugger in the form On Submit event so that you can see the MySQL query that is being created. That should help you diagnose the problem here.
PS You should also try clearing the ChronoForms cache if you have added a new column to the table.
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
admin 32
January 02 2021, 23:36 #395548
Easiest solution is to use v7 and in the "Save Data" action, use the "Data sources" advanced setting, then add a new table field "name" and set the value to {user:name}