[html-formfu] Very similar forms for edit and add
Carl Franks
fireartist at gmail.com
Mon Mar 8 10:37:20 GMT 2010
2010/3/8 Alex Povolotsky <tarkhil at over.ru>:
> Hello!
>
> I'm writing (yet annother) CRUD controller, and I need two very similar
> forms, for add and edit a user.
>
> On adding user, I'd like to set password field required; for editing, it's
> not, and empty password field means "password unchanged".
>
> What's the best way to implement this functionality without having two
> similar config files?
Hi,
If it's just the constaint that differs - I'd suggest defining the
form without the constraint in "user_edit.yml"
Then in "user_add.yml", just do:
---
load_config_file: 'user_edit.yml'
constraints:
- type: Required
name: password
Carl
More information about the HTML-FormFu
mailing list