On Sat, Jul 12, 2008 at 9:35 PM, Daniel Stevens <[EMAIL PROTECTED]> wrote:
> Now it seems 1.1 wants me to
> create a form and validate it which is more work and overhead then I need.
> How do I validate POST vars that come in as a request without having to make
> a HTML form?
I've just made this quick poc:
public function executeTest(sfWebRequest $request)
{
if ($request->isMethod('get'))
{
$v = new sfValidatorNumber(array('min' => 1, 'max' => 5));
try
{
return $this->renderText(sprintf('Value "%d" is okay',
$v->clean($request->getParameter('foo'))));
}
catch (sfValidatorError $e)
{
// Handle validation error and message here
return $this->renderText($e->getMessage());
}
}
}
It makes me think that this will be "a bit" redundant with the new
input filtering implementation planned for 1.2...
++
--
Nicolas Perriault
http://prendreuncafe.com - http://symfonians.net - http://sensiolabs.com
Phone: +33 660 92 08 67
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" 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-users?hl=en
-~----------~----~----~----~------~----~------~--~---