Problem with custom Field Validation using Delagate class me

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

Postby dtrimbur » Thu Jan 11, 2007 6:22 pm

I wanted to add a custom field validation method, so I followed the example in the how to's as below.
But I always get the error messages below when the method returns false. (Works fine if validation is true.) Did something change in Dataface since the example was written? Or I'm I missing something here?

code:
-----------------------------------------
function Proteins__validate( & $record, $value, $params){
$result = true;
$proteins = explode(";",$value);
foreach($proteins as $k=>$line){
$seq=trim($line);
if ($seq !='') {
$ProteinRecord = df_get_record ( 'Proteins', array('Name' =>'='.$seq) );
if ($ProteinRecord == null){
$params['message'] = "Sorry, protein name: $seq not found.";
$result = false;
}// end if null
} //end if seq =''
} // end foreach
return $result;
} //end function

--------------------------------------------------------------------------------
Error returned:


Fatal error: [pear_error: message="" code=211 mode= level=notice prefix="" info="On line 74 of file /Library/WebServer/Documents/dataface/Dataface/Error.php in function printstacktrace()
On line 1394 of file /Library/WebServer/Documents/dataface/Dataface/QuickForm.php in function permissiondenied(,,)
On line 1273 of file /Library/WebServer/Documents/dataface/Dataface/QuickForm.php in function pushfield(Proteins)
On line 1862 of file /Library/WebServer/Documents/dataface/Dataface/QuickForm.php in function push()
On line of file in function save(FN2---FN5; GG36-G97E-S99N; GG36-G97D-S99N; GG36; BLAP; WO0183559-0031; US20050181446-0031; PB92---Sa)
On line 1608 of file /Library/WebServer/Documents/dataface/lib/HTML/QuickForm.php in function call_user_func(Object-save,FN2---FN5; GG36-G97E-S99N; GG36-G97D-S99N; GG36; BLAP; WO0183559-0031; US20050181446-0031; PB92---Sa)
On line 103 of file /Library/WebServer/Documents/dataface/actions/edit.php in function process(Object-save)
On line 742 of file /Lib in /Library/WebServer/Documents/dataface/Dataface/QuickForm.php on line 1881
dtrimbur
 
Posts: 3
Joined: Wed Dec 31, 1969 5:00 pm

Postby shannah » Fri Jan 19, 2007 1:12 am

Hi,

I haven't forgotten about this question... I haven't been able to test this out to figure out the problem.
In the mean time, you can achieve your goal by creating a beforeSave() trigger that does the processing. I believe there is an example of this in the Getting started tutorial in the section on triggers.

More later..

-Steve
--
Steve Hannah
@shannah78 (on twitter)
sjhannah.com blog
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 7 guests

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