Hi! i am trying to make some enhancements to my forms and my validators system.
I would like to register a config handler that would be called
validators.yml (done), wich i want to be able to load the validator settings
from an yml file.
The bad think is that i cannot find a proper event to attach my enhancer. I
have tried several, but none worked:
- form.post_configure (which is called when a form is constructed, i would
attach here, but it seems is not working )
- form.filter_values (which is called before binding. It would be an ideea
to attach here right before the binding )
- i have tried others, but none was the correct one ....
This is what i have wrote until now, but i don't get the expected result.
in my frontend i have:
public function initialize()
{
$enhancer = new sfFormYamlEnhancer($this->getConfigCache());
$enhancer->connect($this->dispatcher);
$validators = new sfValidatorFormYamlEnhancer($this->getConfigCache());
$validators->connect($this->dispatcher);
}
The enhancer is working correctly as is the sfAdventCalendar's example
the validators is not working properly, and this is the rest of the code:
class sfValidatorFormYamlEnhancer
{
protected
$configCache = null;
public function __construct(sfConfigCache $configCache)
{
$this->configCache = $configCache;
$this->configCache->registerConfigHandler('config/validators.yml',
'sfValidatorFormYamlConfigHandler'
);
}
public function connect(sfEventDispatcher $dispatcher)
{
$dispatcher->connect('form.post_configure',
array($this, 'filterParameters'));
}
public function filterParameters(sfEvent $event, $parameters)
{
print_r($event);
die();
// ....
}
The rest is not essential at this moment, as i do not get a print_r() output
on any of variables: $event / $parameters, even if i have cc-ed, and tried
by refresh or post ... but nothing worked... (i get the layout output
without any problems ... even i am on a page that contains a form ... )
All what i want to do is to initialize / configure the validators from an
yaml file ...
Any ideeas ?
Using symfony 1.4.2, Ubuntu 9.10, php 5.2.1, apache 2.1.12.
thanks
Alecs
--
Have a nice day!
Alecs
As programmers create bigger & better idiot proof programs, so the universe
creates bigger & better idiots!
I am on web: http://www.alecslupu.ro/
I am on twitter: http://twitter.com/alecslupu
I am on linkedIn: http://www.linkedin.com/in/alecslupu
Tel: (+4)0748.543.798
-- 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.
