Forums

error function bind()...

beillard 13 Jan, 2010
Hi,

My form works perfectly with chronoform ( data are save in two tables)

I use Chronoconnectivity to make a list of selected records.
When I edit one record ( with the button {edit_record}, I get error
Fatal error: Call to a member function bind() on a non-object in ....components/com_chronocontact/libraries/customcode.php(71) : eval()'d code on line 13
.

If I save data in one table only, It works perfectly.... But I need two tables

Help please

Regards

André

PS : there are no "-" in field name
GreyHead 13 Jan, 2010
Hi André,

What's in the Autogenerated code box please? - the error is from line 13 of that.

Bob
beillard 13 Jan, 2010
Hi Bob,

Thanks for your advice.

The code :
<?php
		$MyForm =& CFChronoForm::getInstance("projetCG");
		if($MyForm->formparams("dbconnection") == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_evaluation", "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_evaluation"] = $row;
		}
		?>
		<?php
		$MyForm =& CFChronoForm::getInstance("projetCG");
		if($MyForm->formparams("dbconnection") == "Yes"){
			$user = JFactory::getUser();			
			$row =& JTable::getInstance("chronoforms_projet", "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_projet"] = $row;
		}
		?>
		
GreyHead 13 Jan, 2010
Hi André,

It looks as though ChronoForms hasn't saved details of the chronoforms_evaluation table in the database.

Open the DB Connection tab, set it to No and apply the form to save it. The re-open the tab, select both tables in the drop-down, re-set to Yes and Apply again; that should refresh the connection data.

Bob
beillard 13 Jan, 2010
Hi Bob,

I did what you said, but the result is the same.
This form (where data are saved in two tables) works well from chronoform, but does not work when it is called by Chronoconnectivity.

What is wrong in Chronoconnectivity?

André
GreyHead 14 Jan, 2010
Hi André,

Specifically I don't know. There are several bits of ChronoConnectivity that don't work quite as well as they might. I'll look at the issue when I can - or hopefully Max will issue an improved version.

I just link directly to the ChronoForm using a custom url instead of using the {edit_record} syntax.

Bob
beillard 14 Jan, 2010
Hi Bob,

Thanks a lot for your help.
Custom URL instead of {edit_record} works well.

Max you can access to the backend if you want to check this point (just tell me if you want a login).

Best regards


André
This topic is locked and no more replies can be posted.