Hi there,
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
Hi Kenny,
If you have v5 then in the "conditions" box:
<?php
$user = JFactory::getUser();
return array("user_id_field" => $user->get("id"));
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
ok thanks for that...I am now one step closer. I switched debug on so I can see what is happening.
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
Hi 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
Please change the "DB Read" setting "Multi read" to "No"
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Awesome....its simple when you know how.
good morning
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)
Hi Mic77,
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
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
when I put this code, I display:
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'
The field name is "user_id", but not "user_id_field"
Regards,
Max
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?
Thank you, that's right 🙂
I also like that it does not register a new row in my database,
but update, what code in my DB Save?
for updating the record, use the same code in the "db save" action in the "update conditions" box!
Max
ChronoForms developer...
Did you try ChronoMyAdmin for managing your Joomla database tables ?