Forums

Save last username that modifies data

angelmorales 29 Dec, 2020
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:
<?php
$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 31 Dec, 2020
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.

Bob

PS You should also try clearing the ChronoForms cache if you have added a new column to the table.
Max_admin 02 Jan, 2021
Answer
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}
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
You need to login to be able to post a reply.