Forums

Chronoform v2.3 question

otinane 07 Oct, 2011
I am using v2.3 of chronoforms.When i am creating a new form and connect it to a table,before the connection i have to do "create table".When i create the table there are already some options like recordtime,uid,cf_user_id e.t.c

My question is how can i make it so the form saves the cf_user_id as id.To fully understand,what i want to do is when the user fills in the form i want to take his id and store it in the table under a field with name "id" and not "cf_user_id"
GreyHead 07 Oct, 2011
Hi otinane,

Add an id column in the table with Type Integer.

Make sure that the User id is in $form->data['id'] Adding this in a Custom Code element will do it
<?php
$user =& JFactory::getUser();
$form->data['id'] = $user->id;
?>

Bob
otinane 07 Oct, 2011
the custom code works with 2.3 ?
GreyHead 07 Oct, 2011
Hi otinane,

Sorry, In ChronoForms 2.3 I'm not sure. In 3.2 it would be
<?php
$user =& JFactory::getUser();
JRequest::setVar('id', $user->id);
?>
In the OnSubmit Before Email box.

Bob
yaxo 10 Oct, 2011
I have been using this in a v4 form, and it have worked very well until last update to latest v4 rc2.0 and joomla 1.7.
Since the last update it stopped working and I only get a blank space where the data should be. Is something changed so I have to change the code to get my data?

//Anna
GreyHead 10 Oct, 2011
Hi Anna,

In ChronoForms v4 it would be
<?php
$user =& JFactory::getUser();
$form->data['id'] = $user->id;
?>

Bob
yaxo 11 Oct, 2011
Tried it but it did not work😟, and the form was not saved to the database either now, do not know where it went wrong, changed to right name of the table in the code and used it as I have done before.
Will try to look more into it in the weekend..

///Anna
This topic is locked and no more replies can be posted.