I'm confused

A place for users and developers of the Xataface to discuss and receive support.

I'm confused

Postby clawes » Thu Jul 05, 2012 8:38 am

I have form for a table named distribution_list using the PHP class below.
Whenever I try to add or update an existing record, Xataface takes me to an empty page.
The apache error_log file is showing the following error:
Code: Select all
[Thu Jul 05 11:15:01 2012] [error] [client 10.12.12.73] PHP Fatal error:  Call to undefined function hasWhiteSpace() in /var/www/html/contacts/tables/distribution_list/distribution_list.php on line 17, referer: http://file1.ykf.navtech.corp/contacts/index.php?-action=new&-table=distribution_list


This error seems to suggest that I am missing the hasWhiteSpace function. However this function is clearly defined in the ../tables/distribution_list/distribution_list.php function as shown in the code below.
What am I missing?

Code: Select all
<?php
class tables_distribution_list {

function beforeSave(&$record)
{
        $this_user = $_SESSION['UserName'];
        $record->setValue('username',$this_user);
}


function hasWhiteSpace($string)
{
        return (strpos($string, ' ') > 0);
}

function name__validate(&$record, $value, &$params){
   $result = hasWhiteSpace($value);   // This is line 17
    if ( $result ){
        $params['message'] = 'The distribution list must not contain spaces';
        return false;
    }
    return true;
}
}
?>

clawes
 
Posts: 22
Joined: Mon May 07, 2012 12:02 pm

Re: I'm confused

Postby shannah » Thu Jul 05, 2012 12:32 pm

You defined hasWhiteSpace() as a method of the delegate class - not as a global function. Therefore it needs to be called like
Code: Select all
$this->hasWhiteSpace()

not
Code: Select all
hasWhiteSpace();


-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 47 guests

Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved