I try to fill a form with data from a table.
In the Events I have a custom code with:
<?php
$user =& JFactory::getUser();
?>
And a DBRecord loader that loads the user table.
In the Where section I have 'username' = ".$user."
I would like to show the field values for the logged in user in a Textboxes, is that possible?
Rob
In the Events I have a custom code with:
<?php
$user =& JFactory::getUser();
?>
And a DBRecord loader that loads the user table.
In the Where section I have 'username' = ".$user."
I would like to show the field values for the logged in user in a Textboxes, is that possible?
Rob
Hi Rob,
Please see this FAQ
Bob
PS the syntax of your WHERE statement is broken: column names need to be in back-ticks `` not straight quotes; $user is an Object not a value there - you need $user->username; and any $ parameters need to be used inside <?php ?> tags. So this might work:
Please see this FAQ
Bob
PS the syntax of your WHERE statement is broken: column names need to be in back-ticks `` not straight quotes; $user is an Object not a value there - you need $user->username; and any $ parameters need to be used inside <?php ?> tags. So this might work:
<?php
$user =& JFactory::getUser();
echo " `username` = '{$user->username}' ";
?>
but you probably don't need it . . .
Thanks Bob, it works now.
I missed that token is called Request Param in the DB Record Loader, makes sense now that I know it.
I'm trying to convert an old Delphi 2.0 survey program for workplace ergonomics to a web based program.
My programming experience is mostly with Pascal, started with Fortran (on punch cards) and Clipper. After reading some books I have a (very) basic understanding of PHP.
Rob
I missed that token is called Request Param in the DB Record Loader, makes sense now that I know it.
I'm trying to convert an old Delphi 2.0 survey program for workplace ergonomics to a web based program.
My programming experience is mostly with Pascal, started with Fortran (on punch cards) and Clipper. After reading some books I have a (very) basic understanding of PHP.
Rob
Hi Rob,
:-) Ah, yes, nothing like dropping the box of cards to pass a quiet hour or two.
Bob
started with Fortran (on punch cards)
:-) Ah, yes, nothing like dropping the box of cards to pass a quiet hour or two.
Bob
Yes that was always a good one.
Loading a couple of boxes and having one of the last being shredded by the machine was also very funny. It was a good thing the reader was next to the (very noisy ) line printer
Rob
Loading a couple of boxes and having one of the last being shredded by the machine was also very funny. It was a good thing the reader was next to the (very noisy ) line printer
Rob
Is it possible to do the same with a Multi record loader, I would like to use several joint multi record loaders
In the debug the data array is:
Array
(
[option] => com_chronoforms
[chronoform] => x
[username] => admin
[test] => Array
(
[0] => Array
(
[id] => 514
[name] => Super User
[username] => admin
--- more fields ----
)
)
)
I don't know how to link the username to a text box.
Rob
In the debug the data array is:
Array
(
[option] => com_chronoforms
[chronoform] => x
[username] => admin
[test] => Array
(
[0] => Array
(
[id] => 514
[name] => Super User
[username] => admin
--- more fields ----
)
)
)
I don't know how to link the username to a text box.
Rob
Hi RobP,
While it is possible to link several DB Multi Record Loaders (see this FAQ) it's often simpler just to hand code the MySQL query in a Custom Code action and add the resulting array to the $form->data array along with the other form data.
I'm not sure I understand the question about linking a user name to a text box when the data is from a DB Multi-Record Loader?
If it from a DB Record Loader then usually it would be enough to give the textbox the name username.
Bob
While it is possible to link several DB Multi Record Loaders (see this FAQ) it's often simpler just to hand code the MySQL query in a Custom Code action and add the resulting array to the $form->data array along with the other form data.
I'm not sure I understand the question about linking a user name to a text box when the data is from a DB Multi-Record Loader?
If it from a DB Record Loader then usually it would be enough to give the textbox the name username.
Bob
I have a chronoconectivity connection with a couple of linked tables, and a chronoform for editing, the data that works great.
I also want to make something that allows users to edit their own data, if possible with the same connection and form (or a slightly modified version).
For the moment I don't know the right approach.
Rob
I also want to make something that allows users to edit their own data, if possible with the same connection and form (or a slightly modified version).
For the moment I don't know the right approach.
Rob
This topic is locked and no more replies can be posted.