A number of times in my code I have desired to make use of a group of
validators without using a form. Sometimes I'll just write out one or
two validators in my actions but I see a need for a more unified
process. A stripped down sfForm without widgets, rendering etc... just
validation that I can then extend for myneeds. I would provide the
values though a setValues method or such and return my errors so that
I can deal with them in my actions.  If errors occcured, I show
somethingError.php and display the errors - not really meant for user
editing such as a form but a mass validation for other reason.

Has anyone else come across this need?  Is this something to be
explored?

I am personally about to create a myValidationFilter class or
something like that (not sure what to call it) that would be like
sfForm with only the validatorSchema and validatorErrorSchema parts.

For those wondering of possible scenarios consider this one. I have
membership plans. If a user wishes to downgrade the system will check
about 10 things to see if there will be issues. If there are I need to
let the user know that downgrade is not possible until they take care
of this. So it needs to validate about 10 things and return the
correct error messages. Thsis is not a form as there is nothing the
user can fill in. If there is an error they need to go do something in
their admin and come back and try again.   Writing out 10 validators
in my actions is messy and not test friendly. Slapping the same code
in my table method is also not what I want. Id like to simply say
something such as:

$val = new planModifyValidationFilter();
//set plan values however
...

if($val->validate())
{
return sfView::SUCCESS;
}
else
{
$this->errors = $val->getErrors();
return sfView::ERROR;
}


Thoughts?

-- 
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en.

Reply via email to