id, "post", "int", "" )); $post = JRequest::get( "post" , JREQUEST_ALLOWRAW ); if (!$row->bind( $post )) { JError::raiseWarning(100, $row->getError()); } if (!$row->store()) { JError::raiseWarning(100, $row->getError()); } $MyForm->tablerow["jos_chronoforms_customer_form"] = $row; } ?>"> Form data from previous user - Forums

Forums

Form data from previous user

creezi 29 Mar, 2011
I am trying chronoforms with Bixie Virtuemart module. This works great, but I have a bug. When the form is filled out by a user, the next user will not get his data, but the data from the previous user. I found the problem that the $inum is being remembered and with the result in my form that he loads the previous data.

Now I want to unset (in the onsubmit php field) what is done in the autogenerated code by chronoforms. So when the form has been sent, the $inum will be empty again. Btw, this also is done when I clear the cache of joomla.

I have tried EVERYTHING in the passed 2 1/2 weeks, but can't seem to get it to work. Can anybody help me to unset what is set below? Help would be SO MUCH appreciated.

The code from the autogenerated form:

<?php
		$MyForm =& CFChronoForm::getInstance("customer_form");
		if($MyForm->formparams("dbconnection") == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_customer_form", "Table");
			srand((double)microtime()*10000);
			$inum	=	"I" . substr(base64_encode(md5(rand())), 0, 16).md5(uniqid(mt_rand(), true));
			JRequest::setVar( "recordtime", JRequest::getVar( "recordtime", date("Y-m-d")." - ".date("H:i:s"), "post", "string", "" ));
			JRequest::setVar( "ipaddress", JRequest::getVar( "ipaddress", $_SERVER["REMOTE_ADDR"], "post", "string", "" ));
			JRequest::setVar( "uid", JRequest::getVar( "uid", $inum, "post", "string", "" ));
			JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
			$post = JRequest::get( "post" , JREQUEST_ALLOWRAW );			
			if (!$row->bind( $post )) {
				JError::raiseWarning(100, $row->getError());
			}				
			if (!$row->store()) {
				JError::raiseWarning(100, $row->getError());
			}
			$MyForm->tablerow["jos_chronoforms_customer_form"] = $row;
		}
		?>
GreyHead 29 Mar, 2011
Hi creezi,

I don't know anything about the plug-in and as you can see from the code $inum is a random string that is generated for each save. I'm not at all clear how that is used in the Bixie VirtueMart module.

Nor am I sure why it's a problem. Possibly because you are testing different user from the same computer and the user session isn't clearly correctly??

Bob
creezi 29 Mar, 2011

Hi creezi,
Possibly because you are testing different user from the same computer and the user session isn't clearly correctly??

Bob



I already thought of that, so I have tested at work on 4 different computers, with the same problem. Even tested from different ip-addresses with the same problem. It's also totally random, sometimes the form does work correctly, sometimes it doesn't. But if cleaning the cache of joomla resolves the problem, wouldn't unsetting the variables after submitting, also solve the problem?
creezi 29 Mar, 2011
No ideas on what code I should use based on above code?
creezi 29 Mar, 2011

Hi creezi,

I don't know anything about the plug-in and as you can see from the code $inum is a random string that is generated for each save. I'm not at all clear how that is used in the Bixie VirtueMart module.

Bob



Hi Bob,

I discovered that $inum is stored in the VM order items. But frequently the $inum data from the previous user is stored, causing the data from the previous user being showed.
This topic is locked and no more replies can be posted.