Sub-fields of flexifield set as required fail validation on node save.
pkej - March 4, 2009 - 04:48
| Project: | Flexifield |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | needs work |
Description
In alpha 1 I could set the flexifield to required and add data in it, and it would save.
After upgrading to alpha2 the required fields will never save, the node can not be edited.

#1
Subscribing. I think this problem is quite critical, since requirement validation is important for correct content submission (unless you rely on moderator to check every piece of content).
#2
#3
#4
subscribing. Having the same problem here.
#5
As I mentioned in #291864: Make it easier to delete an item, the validation must not be done for a set in which all fields are empty, as this sets are ment to be ignored by cck.
#6
Exactly, ignoring an item with all fields empty would solve all of the issues I have with Fiexifield. Any estimation on when this could be done? Or any hint as to how one can fix this?
#7
It is quite tricky. When flexifield renders widgets for every child field, they set "required" property depending on child field item delta and field "required" setting. This is done so optional rows in multiple values field don't fail validation, and there is only row 0 required. Now in flexifield this leads to the bug when in every flexifield row child field have first delta starting from 0 so if child field is required every 1st row in every flexifield row becomes required.
I tried to overcome this bug: I inserted fake "required" field setting so on flexifield row 0 child fields can be required but on row 1 and more they can't.
This seem to only partially fix this problem cause it all still fails validation. Probably we need to insert more fakes to make all field validations pass.
My half-working patch is attached, I hope you guys will come with new ideas for this. I think there's much more needs to be done, as it's only widget validation and some fields may have additional validation at field level.
We need someone that has good knowledge of FAPI and CCK to fix this probably..