Custom validation issue

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

Custom validation issue

Postby loljak » Thu Jul 05, 2012 2:00 am

Hi,

I'm relatively new to Xataface, and I think this is a great app which give you the ability of building in a quick way something you can give to your client, this is a nice base for further development.

I need to validate a date field, I have written a simple test in the delegate class, using the name_of field__validate method. I have tested this function with Xdebug using breakpoints and step by step for walking in my code. It returns true if the date is valid (Posterior to the last record) and false if not... That is quite simple, but when I run the app I can't validate the forms without an occurring error ... I've got no apache error, and no more information about this except 'Erreurs' (I'm French...) in the error reporting block. Without my validate function, the same new record is OK...

All the variables shown by Xdebug seems me to be coherent. And I don't alter one of the values passed by reference..

I'm running last xataface version in a Lamp context (Debian squeeze, PHP 5.3).

Is anybody have an idea of what I'm missing?

Thanks for your help.
loljak
 
Posts: 3
Joined: Wed Jul 04, 2012 11:38 pm

Re: Custom validation issue

Postby loljak » Fri Jul 06, 2012 12:25 am

I have solved the problem, but I don't understand really why. I have a mysql query in the function, and if I test the return with
Code: Select all
if (!$result)
I've got trouble, and the function allways return false. with
Code: Select all
if (!is_resource)
all is working fine...

Sounds like if the validate function is executed twice...
loljak
 
Posts: 3
Joined: Wed Jul 04, 2012 11:38 pm

Re: Custom validation issue

Postby shannah » Fri Jul 06, 2012 10:06 am

If you can show me the source code, I may be able to tell you why.
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 6 guests

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