Hello,
I recently startet to try out chronoforms and already understood a lot. But there are still some questions. I will post them in seperately.
For a prefilled form I tried to get some userdata (e.g. name) from the __users-table. I'm able to do this with custom code in the Code-Tab. The thing is, everytime I want to alter the form design with wizard designer, I have to switch in the Code-Tab, save and enter custom code again. So I tried to to this in the Setup-Tab ... and failed.
Details:
The onload area starts with a Custom Code event, containing: <?php $user =& JFactory::getUser(); ?>
After that I use DB Read. Here I put: Fields: name, Conditions: <?php return array("id" => "$user->id"); ?>
Notice: Undefined variable: user in C:\xampp\htdocs\joomla3\administrator\components\com_chronoforms5\chronoforms\actions\db_read\db_read.php(48) : eval()'d code on line 1
Notice: Trying to get property of non-object in C:\xampp\htdocs\joomla3\administrator\components\com_chronoforms5\chronoforms\actions\db_read\db_read.php(48) : eval()'d code on line 1
Notice: Undefined index: Data in C:\xampp\htdocs\joomla3\administrator\components\com_chronoforms5\chronoforms\actions\db_read\db_read.php on line 71
What have I done wrong?
Moreover, how exactly do I enter the read values in the forms. I've read distinct syntaxes. Is it Data[name] or Data.name? Do I have to put it in curly brackets?
Thanks in advance,
Christian
I recently startet to try out chronoforms and already understood a lot. But there are still some questions. I will post them in seperately.
For a prefilled form I tried to get some userdata (e.g. name) from the __users-table. I'm able to do this with custom code in the Code-Tab. The thing is, everytime I want to alter the form design with wizard designer, I have to switch in the Code-Tab, save and enter custom code again. So I tried to to this in the Setup-Tab ... and failed.
Details:
The onload area starts with a Custom Code event, containing: <?php $user =& JFactory::getUser(); ?>
After that I use DB Read. Here I put: Fields: name, Conditions: <?php return array("id" => "$user->id"); ?>
Notice: Undefined variable: user in C:\xampp\htdocs\joomla3\administrator\components\com_chronoforms5\chronoforms\actions\db_read\db_read.php(48) : eval()'d code on line 1
Notice: Trying to get property of non-object in C:\xampp\htdocs\joomla3\administrator\components\com_chronoforms5\chronoforms\actions\db_read\db_read.php(48) : eval()'d code on line 1
Notice: Undefined index: Data in C:\xampp\htdocs\joomla3\administrator\components\com_chronoforms5\chronoforms\actions\db_read\db_read.php on line 71
What have I done wrong?
Moreover, how exactly do I enter the read values in the forms. I've read distinct syntaxes. Is it Data[name] or Data.name? Do I have to put it in curly brackets?
Thanks in advance,
Christian
Oh, I forgot: What is shown small and bold above are the hints I get when I open the form in the front-end, logged-in.
Hi Christian,
You just need a "db read" action before the "html" action with this code in the "Conditions":
Your form fields names should match the fields names in the users field, OR, if you enable the "read under model id" in the "db read" then your form fields names should include the model id as well:
Model[field_name]
Regards,
Max
You just need a "db read" action before the "html" action with this code in the "Conditions":
<?php
$user = JFactory::getUser();
return array("id" => $user->get("id"));
Your form fields names should match the fields names in the users field, OR, if you enable the "read under model id" in the "db read" then your form fields names should include the model id as well:
Model[field_name]
Regards,
Max
That's it?! So you can put more than just the conditions in the conditions field? You just have to create an array...
Thanks a lot!
Thanks a lot!
This topic is locked and no more replies can be posted.