Needs review
Project:
Flexifield
Version:
6.x-1.x-dev
Component:
Code
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
4 Mar 2009 at 04:48 UTC
Updated:
22 Nov 2010 at 14:22 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
crea commentedSubscribing. 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).
Comment #2
crea commentedComment #3
crea commentedComment #4
Anonymous (not verified) commentedsubscribing. Having the same problem here.
Comment #5
Anonymous (not verified) commentedAs 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.
Comment #6
TripleEmcoder commentedExactly, 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?
Comment #7
crea commentedIt 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..
Comment #8
giorgio79 commented+1 I am getting this as well.
I solved it now by removing the required option on the sub node fields, and just informing users that they must fill it out.
Comment #9
masande commentedsubscribing. this is indeed a critical issue.
Comment #10
phantomvish commentedSubscribing
Comment #11
Drupal Jedi commentedSubscribing. This issue really needs to be addressed.
Comment #12
dan_liip commentedWe ran in this issue as well and we could not afford removing the required fields from the sub-fields.
To correct this my colleague moritzz (http://drupal.org/user/132136) created the enclosed patch that I submit on his behalf.
Basically it works this way: it checks if a subform element is empty and if so the element and all its children get the required flag cleared so further validation passes silently.
This patch is not perfect and will not work with all the types of sub-fields. For example we know there are problems with the date fields because of the way they check if they are empty. Since we don't use date fields in our project we didn't take the time to dig into this further. But with some code hacking it must be possible to use date fields as well.
We have also to mention that for sub-fields of type file field, this patch will only work if you enabled the "flexifield filefield integration" module.
Comment #13
dan_liip commentedIn addition to the patch created by moritzz you may find usefull this quick modification of the flexifield module that make the workaround work for nodereference sub-fields.
// Strangely enough, when a nodereference field is used into a flexifield,
// the value is not stored the same way as when used outside a flexifield.
//
// Normaly the value is stored this way:
//
// $aChildField = array('nid' => THE VALUE)
//
// But in a flexifield, the value is stored with an additionnal array level, like this:
//
// $aChildField = array('nid' => array('nid' => THE VALUE))
//
// Because of this, the normal routine will always consider the nodereference field is NOT empty.
//
// The following code corrects this problem.
Comment #14
paskainos commentedsubscribing
Comment #15
tic2000 commentedComment #16
str1 commentedI encountered this also, has this problem been around for 1½ years already? I think this is quite critical issue and limits the usage of flexifield significally
Comment #17
crea commentedIt is clear that Flexifield was abandoned long time ago.
Comment #18
todd zebert commentedsubscribe.
This is annoying as neither Flexifield nor CCK3 Multigroup are ready for prime time yet, for such a (it seems to me) basic need.
Of course, as only a cut&paste programmer, I can't do anything about it, and probably shouldn't complain.
Comment #19
todd zebert commentedThanks for the support & patch dan_liip & moritzz. It worked for the simple implementation I have.
Comment #20
todd zebert commentedPerhaps I spoke to soon. I'm using Alpha5 and with the patch above.
There doesn't seem to be any way to delete a "record" since the source node shows at least one field as required.
Or am I missing something?
Comment #21
todd zebert commentedSee my comments on the related "record" delete Flexifield thread, http://drupal.org/node/291864#comment-3650452
Comment #22
xen commentedRerolled #12 patch so it should (hopefully) apply via drush make.