I have survey on my website. The site requires users to login first and then they are able to take the survey. I am having a weird result when the submit button is clicked. Initially a row is inserted into the database but does not contain the user_id. Almost immediately another row is inserted with only the user_id and no other information. Does anyone know what might be happening to cause this. A sample of this is attached.
Thanks,
James
[[>> Image removed: Greyhead <<]]
Thanks,
James
[[>> Image removed: Greyhead <<]]
Hi James,
Do you have more than one DB Save action? (Or custom code to save a record?)
Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.
Bob
Do you have more than one DB Save action? (Or custom code to save a record?)
Please drag a Debugger action into the On Submit event, then submit the form and post the debug - including the 'dummy emails' results here.
Note: if you are using the Easy Wizard you can turn on Debug on the Others tab.
Bob
I do have a second DB update in my custom PHP code. It can be seen below.
Below is the debug information.
The odd thing is that it does not happen with every survey that is entered.
[[>> Content edited: Greyhead <<]]
<?php
$user = JFactory::getUser();
$useremail = $user->email;
//$username = $user->name;
//echo "user email is $user->email \n";
//echo "user name is $user->name \n";
// Get DB object
$db =& JFactory::getDBO();
$query = $db->getQuery(true);
// Fields to update.
$fields = array(
'taken_survey_one=\'Y\'');
$email_string = "email_address='$useremail'";
// Conditions for which records should be updated.
$conditions = array($email_string);
$query->update($db->quoteName('xxx'))->set($fields)->where($conditions);
$db->setQuery($query);
try {
$result = $db->query(); // Use $db->execute() for Joomla 3.0.
} catch (Exception $e) {
echo " error occurred";
}
$form->data['user_name'] = $user->name;
$form->data['user_email'] = $user->email;
?>
Below is the debug information.
Data Array:
Array
(
[option] => com_chronoforms
[chronoform] => xxx
[event] => submit
[Itemid] =>
[input_radio_apprentice_year] => 2
...
[user_email] => xxx@xxx.com
[chronoform_data] => Array
(
[cf_uid] => cab981cee8aaf4e222e7a5d5ee7706c6
[cf_created] => 2013-06-30 17:00:11
[cf_created_by] => 355
[cf_ipaddress] => 10...150
[cf_user_id] => 355
[option] => com_chronoforms
[chronoform] => xxx
[event] => submit
[Itemid] =>
[input_radio_apprentice_year] => 2
...
[cf_id] => 26
)
[chronoform_data_cf_id] => 26
)
Validation Errors:
Array
(
)
Thank you for taking the time to complete this survey.
Debug Data
email
10
Result
An email has been SENT successfully from (Name Connecting) // deleted //
Body
xxx just completed the Apprentice Survey. The results of their survey are below.
// deleted//
Attachments
array ( )
Powered By ChronoForms - ChronoEngine.com
The odd thing is that it does not happen with every survey that is entered.
[[>> Content edited: Greyhead <<]]
Hi jlcarpenter,
I don't see anything there that would trigger a second db query unless there is some elusive bug in the code? I assume that it does the update correctly?
Bob
I don't see anything there that would trigger a second db query unless there is some elusive bug in the code? I assume that it does the update correctly?
Bob
The only problem is what is shown in my previous post. Sometimes the user_id and other user info is not recorded in the initial submit. Somehow a subsequent submit is done that records only the user info.
I have looked further and have a possible cause of the problem. We are using LDAP for validation and user creation. It seems that maybe if the users take the survey on the initial login that is when the problem occurs.
This topic is locked and no more replies can be posted.