Flexi-field does not work with multiple flexifields

dijusam - April 23, 2009 - 14:22
Project:Flexifield
Version:6.x-1.0-alpha5
Component:User interface
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

CCK version : cck-6.x-2.2,

Flexi-Field version : flexifield-6.x-1.0-alpha1

1. Created content type named 'course' with two text fields(Both of them are required.)
2. Created another content type named 'view course' with Flexi-Flield, used the above content type 'course'(By enabling checkbox in "Content types that can be used as field items:" + Number of values: Unlimited).
3. In Create content 'view course' on save works fine.
4. When i click Edit i saw the two text fields generated automatically without clicking "Add Another item".
5. Please tell me how to restrict the auto-generation of the two text fields.
6. Otherwise any idea like having remove button against every Flexi-field(combined fields) in order to remove the generated fields simultaneously.

Thanks in Advance.

- Dinesh.

AttachmentSize
img.JPG61.85 KB

#1

walker6o9 - July 30, 2009 - 19:18

I'm trying to fix this myself. Have you had any success so far?

#2

mikey_p - July 30, 2009 - 20:35
Project:Drupal» Flexifield
Version:6.10» 6.x-1.x-dev
Component:other» User interface
Status:needs work» active

#3

crea - August 3, 2009 - 20:29

Did anyone try Flexifield with CCK 3.x experimental branch ? I read in CCK 3.x there are something like "add row" and "remove row" buttons added.

#4

jvieille - October 14, 2009 - 09:50
Version:6.x-1.x-dev» 6.x-1.0-alpha5
Category:support request» bug report
Priority:normal» critical

Same problem appart that I get 4 Flexifields to be filed up by default. It is impossible to get ride of the extra field groups if I need less than 4 value sets.
As no solution was provided to date, this is definitely a bug, which is critical as this does not allow to use this module in production.

#5

jvieille - October 14, 2009 - 10:14
Title:Flexi-field ''Add Another item" Remove excess Text-field» Flexi-field defaults the number of submission occurences to the number of fields in the group

Hint: the number of flexifield occurences in the submission form is equal to the number of fields in the group.

I changed the title accordingly

#6

Shiraz Dindar - October 24, 2009 - 17:57

subscribing

#7

jvieille - October 22, 2009 - 09:41

No reaction? This should be easy to fix now.
This bug is really critical: I don't think anyone can use this module as is with multiple fields.
I am really curious to know how the 800 weekly downloads are actually used in production sites. Multiple fields cannot be so uncommon.

This is a really useful module. I don't know other ways to create interactive forms that integrate with the site content (Webform don't do that). I hope we can get it work soon.

Thanks for a rapid action by capable people

#8

effulgentsia - October 22, 2009 - 17:03

Hi all, in case anyone here hasn't read my status update on the project page, I wanted to say that I apologize for not having maintained this module well for the past couple months. I've been busy helping out on Drupal 7 core development. The code freeze for that was originally scheduled for 10/15, then extended to 10/19, we hit a snag on a couple important issues, and are now waiting for Dries to announce what is to happen to them. I'm pleased with what everyone has been able to accomplish with Drupal 7 prior to the freeze, and with my small contributions to it. I will be resuming maintenance on flexifield within the next couple days. Thank you for your patience.

#9

jvieille - October 22, 2009 - 17:44

Thank you for the notice.
Take care

#10

Rhino - October 23, 2009 - 11:42

where does the field (the extra ones) come from? I don't mind removing them 'by hand' if it's a number change somewhere in the database.

I have one administrative user who has two extra fields, and another n00b admin who clicked add by mistkae and now always has three. Neither one of us want this but we can't get rid of it.

#11

Poieo - October 23, 2009 - 21:30

Subscribing.

#12

jvieille - October 25, 2009 - 17:09

One problem here is that Flexi-field wants to process all the displayed fields: if we get 5 like me, 5 values have to be entered. There are no way to get rid of the unneeded extra fields.
The common practice in Drupal for multiple fields seems to ignore empty fields. If Flexi-field would behave like that, we would not complain so much about these extra fields...

#13

jvieille - November 9, 2009 - 10:09

Anyone looking at this problem.?

#14

andrewspringman - November 9, 2009 - 23:38

First, Flexifield is awesome. It is doing exactly what I need (besides this issue). Thanks!

I've read this thread and a number of others. Rather than trying to discuss this in generic terms, I'll explain my application. This may mean that I'll go over stuff that's been discussed before. I hope it is helpful to have it all in one place.

I'm making a song database with transpose, pdf and setlist capabilities.

I've got two content types: Song and SetList.

Song contains the lyrics and the chords and then some fields that are used for interpreting the chords. For the purposes of this discussion, we only care about one of the other fields, Entered Key. This tells the system that the lyrics and chords are in, say, G. This way, later when you want to transpose to A (the Printed Key), it knows that it needs to move each chord one wholestep up.

The SetList contains a list of Song node references paired with Printed Keys. For example:

Song One (C)
Song One (D)
Song Two (Bb)

The reason I am using flexifield is that I need the Song reference and the Printed Key to move together when you change the order or the songs in the SetList. I can't attach keys to the nid of the Song because as you see above, I made need multiple instantiations of the Song with different keys (or just plain old reprises).

So, I created another content type, Transposed Song, for the Flexinode.

During the lifecycle of a SetList it will be edited quite often. Songs need to get removed and added. The order needs to change. Songs need to be switched to different keys. Each time one of these changes are made and saved, a blank pair is added. (It is not limited to the number of fields in the Flexifield as previous entries in this thread suggest). BTW, I'm using "unlimited" for the number of items.

The first thing I did was to change my theme for SetList to skip empty Song/Key items. That works, but every time the user goes into "Edit" they see a large number of empty Song/Key items. It's ugly and confusing. The users ask where the delete button is for Song/Key items. I tell them to live with it.

So, I thought of several approaches to fixing this myself (because programmers are impatient and I need it to work now).

1) Whenever the full node is viewed, delete all the extra items in the SetList theme code.

Easier said than done.

There is information about the Flexifield stored in a number of places. I deleted all the rows in the Transposed Song content type's table where the Song reference was NULL. I then deleted all the rows in the Song/Key field's table when (after unserializing) the Song reference was NULL. I then used the item ids from the last table to delete entries in the flexifield_entires table.

Still, when I enter "Edit" all the blanks are still there. I've search for someplace where there is a count of fields or another place where the Flexifields are held. I can't find it. Any help? Is this some sort of caching issue rather than an actual value in the database that I missed? If so, is there a programatic way to clear that cache?

Can I call flexifield_field directly with a delete operation? I couldn't see it doing anything different than what I described above, anyway.

BTW, just getting rid of these automatically would be way better than having a delete button next to each one. I know that proposal has been floating around. I wouldn't mind having it, but I don't think it is the right solution to this problem.

2) I've also thought that I could patch CCK in general not to display a blank field (to let the user click "Add another item" to add the first item). I don't view that as a hardship and I don't think my users will either. However, I can't figure out where that is within the base CCK code. I also don't like the idea of patching someone else’s code (except to submit the change for the next version). It's a maintenance nightmare.

3) Patch Flexinode to not save the empties. I couldn't find any problem with flexifield_content_is_empty or any other code in Flexinode itself that was responsible for empties.

4) Patch the bug in CCK mentioned in the comments for flexifield_content_is_empty. Well, I'm lost in a sea of code. I don't know how Flexinode registered flexifield_content_is_empty as a call back in CCK, so I can't find where it is being called.

Does anyone have any help in any of these directions, or perhaps a completely different direction?

Thanks!

#15

andrewspringman - November 11, 2009 - 15:33

Hallelujah! I have a solution

Since my theme template was already skipping the empties for the display, I just delete them from $node when I skip them and then later call node_save. To my amazement, it worked! I have to congratulate the CCK and Flexifield module teams. There's a whole lot of design and careful coding behind making it that easy.

          $i = 0;
          foreach ($node->field_song_key as $song)
          {
            $n = $song['value']['field_songsheet'][0]['nid'];
            if ($n == '')
            {
              //todo: delete extra songs for later node_save
              unset($node->field_song_key[$i]);
              ++$i;
              continue;
            }
            ++$i;

and then later on

        node_save($node); //makes the delete of empty song/key fields permenant.

There was one tiny snag that is worth mentioning. I also had a date field that I was automatically displaying in the full node. Every time I viewed the full node, another copy of the date was added to the body. I don't see how that is avoidable. Everything is working as designed. So, I just excluded the date field from the full node display and displayed it myself in the theme template. No big deal.

#16

jvieille - November 11, 2009 - 17:57

Hum...
Not clear what you are addressing nor how.

Have you found the bug that makes imposssible to use an "unlimited" flexifield (I was never able to save a node with such a field)

I understand that you modifed your theme, which is a hack, not a workable solution.
You give a piece of code, where do you put it?

Thanks

#17

ionz149 - November 11, 2009 - 20:20

subscribing

#18

jvieille - November 20, 2009 - 08:06
Title:Flexi-field defaults the number of submission occurences to the number of fields in the group» Flexi-field does not work with multiple flexifields

This post receives very little attention.
Is nobody using forms with multiple occurences of the same group of fields?
Flexifield seems theoretically the only way to do that.

I changed the title to reflect the actual concern.

#19

jvieille - November 23, 2009 - 15:16

Hello???

#20

ikeigenwijs - November 24, 2009 - 13:13

same problem

#21

crea - November 24, 2009 - 22:38

If you have site in development stage I recommend switching to CCK Multigroup, if it's not late (I did it myself).
Flexifield idea was great but unfortunatly author failed to provide enough level of polish and bugfixing. There are too many critical bugs that are not getting fixed.
OTOH, Multigroup made great progress, and continues to. There are small number of issues, and there are future plans of adding pluggable storage, that will make it possible to have multiple value fields inside single multigroup row (which is currently single strong point of flexifield over multigroup).

#22

jvieille - November 24, 2009 - 21:15

Where is this module?
I an't find it anywhere, just this one wich seems unrelated and not updated since April.
http://drupal.org/project/patch_content_multigroup

#23

crea - November 24, 2009 - 22:37

It is part of CCK 3.x which is hidden from list of releases on CCK page because it's not 'official'. You can see it at "all releases page" http://drupal.org/node/48429/release
I must say, even while it's considered unstable development version, it's much more stable than Flexifield. I don't have any major problems with it.

#24

ionz149 - November 30, 2009 - 22:59

Yeah I ended up using cck3 too

 
 

Drupal is a registered trademark of Dries Buytaert.