I am fairly new to Cronoforms and I am trying to setup my first form.
User logs into Joomla and I want to then give them the option to edit some data which is in a custom table which is tied to their account.
The id they have from the Joomla users table and the id for their record in the custom table are the same.
I have setup a form and if I set the option to read the DB it gives me the first record, which proves that it is reading the table.
What and where do I have to put stuff to get it to read the record for the logged in user.
Thanks in anticipation
Kenny
If you have v5 then in the "conditions" box:
<?php
$user = JFactory::getUser();
return array("user_id_field" => $user->get("id"));
Regards,
Max
I can now retrieve the data based on the logged on user but it is not populating into the form.
Sorry to be a pain but once I get the hang of this hopefully I will be off and running
Kenny
+ The DB Load action needs to be before the HTML (Render Form) action.
+ The column names of the DB Record need to match the input names in the form (including any Model ID you use) or you need to use a Custom Code action to map them across.
Bob
If I only have it pick up the first record in the simple DB Read I get the first record and it puts it in the form.
Could it be the fact that I have things an array that I am not addressing the data items properly
This is what I get from the debug screen
Array
(
[option] => com_chronoforms5
[chronoform] => ApplicationForm
[0] => Array
(
[id] => 342
[username] => xxxxxxxxxx
[app_experience] => Experience Details in Here
[app_bringtoclan] => I bring stuff to the Clan
[app_weakpoint] => My Weak points go in here
[app_timezone] => TZ
[app_other] => Other comments go in here
)
)
On my input form I have my Field Name and field ID set to for example app_experience etc
like I say it works if I only take the first record...
Regards,
Max
I have the same problem,
I have put the "multi read" to "no" and he read me the first user of the database, not the connected user :?
(sorry for my english but I'm french)
In order to get the connected user you must use the "Conditions" box:
<?php
$user = JFactory::getUser();
return array("id" => $user->get("id"));
Regards,
Max
Si les difficultés persistent, merci de contacter l'administrateur de ce site.
1054 Unknown column 'Data.user_id_field' in 'where clause' SQL=SELECT `Data`.`id` AS `Data.id`, `Data`.`uniq_id` AS `Data.uniq_id`, `Data`.`user_id` AS `Data.user_id`, `Data`.`created` AS `Data.created`, `Data`.`modified` AS `Data.modified`, `Data`.`imprimee` AS `Data.imprimee`, `Data`.`nom` AS `Data.nom`, `Data`.`prenom` AS `Data.prenom`, `Data`.`rue` AS `Data.rue`, `Data`.`ville` AS `Data.ville`, `Data`.`sanguin` AS `Data.sanguin`, `Data`.`donneur` AS `Data.donneur`, `Data`.`maladie` AS `Data.maladie`, `Data`.`allergie` AS `Data.allergie`, `Data`.`medecin` AS `Data.medecin`, `Data`.`notaire` AS `Data.notaire`, `Data`.`convention` AS `Data.convention`, `Data`.`personne1` AS `Data.personne1`, `Data`.`personne2` AS `Data.personne2`, `Data`.`checkbox23` AS `Data.checkbox23`, `Data`.`button17` AS `Data.button17` FROM `lf5g6_chronoengine_chronoforms_datatable_carte` AS `Data` WHERE `Data`.`user_id_field` = '505'
Regards,
Max
I also like that it does not register a new row in my database,
but update, what code in my DB Save?
In this line replace the first 'id' with the name of the database column where you have the user ID - it looks as though that is user_id.
return array("id" => $user->get("id")); Simplifying a bit you get:return array("user_id" => $user->id);
Bob
