Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…
Cannot retrieve contributors at this time
34 lines (31 sloc) 2.6 KB
# TODO #
## Version 1.5 ##
* try improving and abstracting the functionality to ignore empty "add new" forms so this does not have
to be managed in the embedding form class anymore
- 1st option is to add a `considerEmptyFields` method to the embedded form class (easy to implement, no need to
update the embedding form class when the embedded form's model changes (add/remove fields), which could be forgotten
- 2nd option is trying to figure out after submit if the form to add a new related record can be considered empty:
* remove all validators that are optional and are empty (needs to be both because the user can also enter something non-required!)
* if the form then has the maximum errors that can exist in the form then the form is empty because the user
did not change anything or filled in any information
* sfGuardUser model
* fields: username, firstname, lastname, gender, zip, city
* username, firstname, and lastname are mandatory
* gender, zip, and city are optional
* on submit:
* the optional fields are all tested for emptiness ($validator->isEmpty()),
if one is not empty, form is considered "not empty"
* the rest is tested for number of errors so I need to know the maximum number of errors
that can be thrown from there; if this number is equal to the number of errors the form has thrown
after validation then - bingo! - the form is considered "empty"
- 3rd option is adding a "Ignore" checkbox and adding a bit of JavaScript that deselect this checkbox
when the user starts typing into one of the inputs/selects a file/checks a checkbox/select an option in a select box etc.
=> this is good: a) because it's easy to implement (at least, the symfony part ;-)),
b) because it's fast (no more checking for empty form fields),
c) because a few edge-cases cannot be done with the current code (embedded form has only two select boxes
that are not empty when the form is created)
=> URLS:
Jump to Line
Something went wrong with that request. Please try again.