Hi. As you can see in the images, I set the hidden user_id field to be filled with the joomla user id before the submit button, but the new record does not have the user_id field filled with it.
What can I do?.
Thanks in advance,
Octavio.
[attachment=0]user_id designer.JPG[/attachment]
[attachment=1]user_id designer edit.JPG[/attachment]
[attachment=2]user_id setup.JPG[/attachment]
[attachment=3]user_id setup edit.JPG[/attachment]
[attachment=4]user_id table.JPG[/attachment]
What can I do?.
Thanks in advance,
Octavio.
[attachment=0]user_id designer.JPG[/attachment]
[attachment=1]user_id designer edit.JPG[/attachment]
[attachment=2]user_id setup.JPG[/attachment]
[attachment=3]user_id setup edit.JPG[/attachment]
[attachment=4]user_id table.JPG[/attachment]
Please see the Form Name used in the image:
[attachment=0]user_id setup edit SOLVED.JPG[/attachment]
[attachment=0]user_id setup edit SOLVED.JPG[/attachment]
Hi Octavio,
To get joomla user you need to add a "&" so, set your code before HTML render action like this:
Then, on Load, your field will be filled.
BN
To get joomla user you need to add a "&" so, set your code before HTML render action like this:
<?php
$user =& JFactory::getUser();
$form->data['id'] = $user->id;
?>
Then, on Load, your field will be filled.
BN
Hi,
If you have v5.0.3 then the user_id field should be filled in automatically if you don't have a "user_id" key in the data array, in other words, just remove your field and it will be stored if a user is logged in.
You can also use a "debugger" instead of "db save" to check the data array before its saved!
Regards,
Max
If you have v5.0.3 then the user_id field should be filled in automatically if you don't have a "user_id" key in the data array, in other words, just remove your field and it will be stored if a user is logged in.
You can also use a "debugger" instead of "db save" to check the data array before its saved!
Regards,
Max
Hi BN,
The & is *not* required in Joomla! 3 - actually in PHP 5.3 and later I think - and may cause a PHP Warning or Notice.
Bob
The & is *not* required in Joomla! 3 - actually in PHP 5.3 and later I think - and may cause a PHP Warning or Notice.
Bob
This topic is locked and no more replies can be posted.