Hi Fabian, Fabian Spillner schrieb: > Your examples with date field are not the good example for the value > transformer. > > If you store ex. the last name in the database with NULL or empty > value and you want to get the value "not specified" on the textfield. > > Would you write a subclass of sfWidgetFormInput or a subclass of a > sfStringValidator? > > It would be cool, if I can write a value transformer and set it on a > form value:
I see your point and understand that this could be useful in some cases. Your actual example is no such case - sfValidatorString (and some others) provides and "empty_value" option which can be used for exactly what you are describing. So it's 1:1 in bad examples ;-) What I fear is that this might increase the complexity of the already quite complex forms framework even more - perhaps too much. It should at least be optional (as Bernhard just wrote, a plugin first). I can see 2 possible options to implement this: * Provide pluggable callbacks like they are used for Propel behaviors in sfWidget and sfValidatorBase * Just add an option "value_transformer" to sfWidget and sfValidatorBase which is used as a function call - so you can simply define a function that is called on the value before display / validation. One thing you didn't specifiy directly is whether there have to be 2 separate transformers - one for the widget (before display) and one for the validation (after submit). I think this would actually be the case... If you find the time to specify something like this please tell me where to find it - I'd like to see how you do it :-) Best regards David --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
