Buy Now
Sign in

Fatal Error: Call to member function bind()

RLaurel , January 02 at 22:32
R
RLaurel
I am receiving a Fatal error: Call to a member function bind() on a non-object in /home/euccc1/public_html/live2/components/com_chronocontact/libraries/customcode.php(71) : eval()'d code on line 13.

I have looked at the Customcode.php & found the eval statement, but do not fully understand what it is doing or what is causing my problem.

I am working on a very old website, (Joomla! 1.5.26), with ChronoConnectivity & ChronoForms. (versions ??)

(Plan to replace the entire website soon with new Joomla! CMS & supporting CC & CF components.)

I have been reading the forums for quite a while on this & post #41063 from fservais, September 30 2009 is the closest I have found so far.

Greyhead's responses seem to provide some clues, but not exactly what I see.

I see Auto Generated Data, but not Auto Generated Code he references to. Where is Auto Generated Code seen?

I have thought of placing some var_dump() & die() statement into customcode.php to assist in problem diagnoses, but since line 71 is in an "if" construct, I think it will break the "if" construct.

What I am doing:
In CC I am allowing specific people to chose a member account for editing (editing account profile (name, address, phone#, etc.), on behalf of someone else)
Once the account is selected, CF brings up the account profile for editing.
When all edits are complete, the "Submit" button is selected.
The failure occurs.

Perhaps, I can get some help because the guys who coded this years ago have left & I have no support presently.
GreyHead
Hi RLaurel,

The error is coming from Line 13 of some Custom code in your form - what exactly is that code?

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
R
RLaurel
Thank you for your prompt reply Bob. Happy New Year to you!

I am looking at the form which someone else wrote, years ago. In the "Form Code" area. There are five areas here.

From the "Form HTML" line 13 is part of a variable definition for something called '$script'

8 $script= "
9 var ff = document.getElementById('volHrsLabel');
10 if(ff != undefined) {
11 //console.log('got VolHrsBal, value=' + ff.value + ', innerHTML=' + ff.innerHTML);
12 hrsinput = document.getElementById('VolHrsBal');
13 hrsinput.value = ff.innerHTML;
14 }
15 else {
16 //console.log('VolHrsBal element undefined');
17 }
18 ";
19 $script .= "
20 var dateForm = document.forms[ 1 ];
22 // setup orientation date
23 setDateDisplay( dateForm.orient_date, dateForm.orient_date_mdy );
24 // setup join date
25 setDateDisplay( dateForm.join_date, dateForm.join_date_mdy );
26 // setup active date
27 setDateDisplay( dateForm.active_date, dateForm.active_date_mdy );
28 // setup inactive date
29 setDateDisplay( dateForm.inactive_date, dateForm.inactive_date_mdy );
30 function setDateDisplay( srcDate, destDate )
31 . . . . .

Form JavaScript & Form CSS do not have a line 13

Form On Submit Code - before sending email ------ Line 13 looks to be a comment to me

1 <!-- Admin Member Update Chronoforms -- On Submit Section before sending email -->
2 <?php
3 $iter = 0;
4 $printDbg = 0;
5 if( $printDbg )
6 {
7 echo 'BEGIN POST variables at beginning of On Submit ';
8 print_r($_POST);
9 echo 'END POST variables';
10 }
11 /* to print out all session variables (many and verbose)
12 echo '<h4>BEGIN session dump</h4>';
13 print_r($_SESSION);
14 echo '<h4>END session dump</h4>';
15 */
16 // check for new email address
17 // CF will update eu_members, we must update jos_users here
18 $newEaddress = $_POST['email_address'];
19 if( isset($newEaddress) )
20 {
21 $previousEmailAddress = "";
22 if (isset($_SESSION['prevEmail']))
23 {
25 $previousEmailAddress = $_SESSION['prevEmail'];
26 unset ( $_SESSION['prevEmail'] );
27 }
28
29 if( $printDbg )
30 {
31 echo '<br />new email address=' . $newEaddress
32 . ', previous email address=' . $previousEmailAddress
33 . ', will update jos_users...<br />';
34 }
35 $userId = getMemberId();
36 $query =
37 "UPDATE `jos_users`
38 SET `email` = '$newEaddress', `username` = '$newEaddress'
39 WHERE `id` = $userId;";
40 .......

Form On Submit Code - after sending email ---- Does not contain a line 13

Extra Code 1 through 5 have no content.

From the "Autogenerated code" tab --- which seems to make since to me because the "bind" reference in the error statement & it relates to the 'autogenerated' area of ChronoContact's "Customcode.php". Wondering if someone shuffled the data field order or type in the "Form Fields Names" or "Form Fields Types" area?

....
11 JRequest::setVar( "cf_user_id", JRequest::getVar( "cf_user_id", $user->id, "post", "int", "" ));
12 $post = JRequest::get( "post" , JREQUEST_ALLOWRAW );
13 if (!$row->bind( $post )) {
14 JError::raiseWarning(100, $row->getError());
15 }
16 if (!$row->store()) {
17 JError::raiseWarning(100, $row->getError());
18 }
19 $MyForm->tablerow["eu_board_members"] = $row;
20 ........
R
RLaurel
Bob, I got it fixed! If you care, this is what happened.

Someone had connected 2 tables through the DB Connection tab. Knowing both tables would need to be updated if specific data were entered, I never suspected anything wrong.

But I notice code in the Auto Generated code tab was duplicated for each table connected. Form Fields Names & Form Fields Types could not be edited for every save of ChronoForms replaced whatever edit I made. (Now I understood the warning provided on the Auto Generated code page. It wasn't clear what could not be edited!) I also noticed in the Auto Generated code line 13 was a bind statement.

Customcode.php was failing at the bind statement of the eval() function in the Function named "autogenerated section within customcode.php.

Removing the ancillary table from the DB Connection tab, corrected the problem. Your hint helped tremendously! Thank you!
GreyHead
Hi RLaurel,

Well done - good to hear that you got it fixed.

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much