开发者

Symfony: Pre filtering submitted values before/after validation

开发者 https://www.devze.com 2023-01-02 15:21 出处:网络
I\'ve been scouring the net and i have found nothing! I am using symfonys form framework t开发者_Go百科o build a simple \'Create\' form. Validation is fine. However i\'d like to pre-filter my submit

I've been scouring the net and i have found nothing!

I am using symfonys form framework t开发者_Go百科o build a simple 'Create' form. Validation is fine. However i'd like to pre-filter my submitted values, so adding ucfirst, strtoupper, and the like.

I'm not sure if im missing something crucial here, but the way i see it is the only way to do this would be to create my own custom validators and utilizing the doClean method, which seems daft since i'd have hundreds of validators for each php function!

Hope you guys can help, i've been crawling through source code, api's, numerous books and blogs and i haven't found a thing :( Either it's impossible, or it's really easy, i hope its the latter!


I apologize for possibly not answering the question, but can you clarify why the values need to be changed prior to binding and validating? This seems like something that could be done as part of sfFormDoctrine::processValues or in the sfFormDoctrine::updateXXXXColumn callbacks. If you're using Propel, there should be similar methods.

0

精彩评论

暂无评论...
验证码 换一张
取 消