Opened 16 years ago

Closed 16 years ago

Last modified 16 years ago

#7278 closed (worksforme)

problem using two manytomany field objects in a change_form.html (when using filter_horizontal = ('field1','field2')

Reported by: martin.harrison@… Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: nfa-someday
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This is an issue that I have spotted - hope you can help.

The bug seems to occur when I have two (or more I presume) manytomantfield objects in a table.

If I use the admin forms to add a row to this table it works perfectly well. However, if I choose in the admin/ModelAdmin options to state that the 2 manytomany fields should be filter_horizontal then this causes the problems.

In the admin form for this table it appears that I can select two rows from the left hand side box and transfer them accross to the right hand side (RHS). I can do this for both manytomanyfield objects.

If I do this for both filter_horizontal manytomany fields and save, it works fine. If, however, I go back into the form (to modify) and select another row from only one of the manytomany fields and send across to RHS - the javascript opens up this box to its full size (rather than a drop down). However, the other manytomany field object is still in a dropdown format for the RHS (clicking on the dropdown shows both values previously saved).

If I then save these changes this is where the problem occurs. It appears that the manytomanyfield where it still had the dropdown has only saved 1 of the 2 values. The manytomanyfield where the RHS was expanded to its full size due to the addition of an extra value is saved successfully.

Is this something specific to the javascript associated with the filter_horizontal option?

Regards,

Martin

Change History (3)

comment:1 by Karen Tracey <kmtracey@…>, 16 years ago

Keywords: nfa-someday added
Resolution: worksforme
Status: newclosed

I cannot recreate this problem. If I have a couple of ManyToMany fields specified in filter_horizontal I can move items from left hand side to right (and vice-versa) willy-nilly, no issues if I only do it with one or both fields. I am confused by the mention of "dropdown" format, I don't see any dropdowns when I specify filter_horizontal -- just two boxes with scroll bars, on the left hand side are listed all "Available" objects while the right side lists those that have been chosen, with controls in the middle to move things from left to right or right to left and underneath the boxes to "Choose all" or "Clear all". Nothing changes size as I select and move items from one side to the other. So, specifics of your models and browser might help in getting someone to understand what it is you are seeing, from the current description I don't see it.

Also marking nfa-someday since I don't believe the code to handle this filter interface has changed in newforms-admin, just the way of specifying it. Therefore whatever this is it is likely a problem in trunk as well and should not block nfa merge.

comment:2 by martin.harrison@…, 16 years ago

Hi Karen - after a little more digging it appears that the problem arises when I have these manytomany filter_horizontal fields within a collapsed fieldset. Only a problem using IE6, firefox works fine. Can correct problem by opening, closing and then re-opening collapsed field in IE6.

Not a major problem but one that does catch you out since no error gets raised and you only save 1 value from the manytomany fields.

comment:3 by Karen Tracey <kmtracey@…>, 16 years ago

OK, the problem with collapsed fieldsets containing the filter interface for ManyToMany is covered by #3110.

Note: See TracTickets for help on using tickets.
Back to Top