I'm loving this module, but the options shown are listed as

I'm using a new install of Drupal 5.7, and using a view to populate the select list. I have had it working on an older version of my site (this is the 2nd time Ive done it!) but this doesn't seem to want to.

if I use the normal nodeselect list, which I feel is a little flimsy - it displays ok?!?

Also using teh Multirefernce CCK node does the same - but I don't really want to use that. This could point to the issue tho - something related to the 2 modules?!?

Any help is very much appreciated!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

l33103’s picture

I'm loving this module, but the options shown are listed as a load of HTML, rather than regular text.

I'm using a new install of Drupal 5.7, and using a view to populate the select list. I have had it working on an older version of my site (this is the 2nd time Ive done it!) but this doesn't seem to want to.

if I use the normal nodeselect list, which I feel is a little flimsy - it displays ok?!?

Also using teh Multirefernce CCK node does the same - but I don't really want to use that. This could point to the issue tho - something related to the 2 modules?!?

Any help is very much appreciated!

attheshow’s picture

Dear l33103,

Did you ever get your issue resolved? Have you tried the new Drupal 6 version of the module?

attheshow’s picture

Status: Active » Postponed (maintainer needs more info)
attheshow’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

No response from poster after three weeks. Closing.

twistor’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Category: support » bug
Status: Closed (fixed) » Active
FileSize
10.61 KB

I can confirm this, with multiselect-6.x-1.x-dev. It works fine for adding the node, but if you go to edit the node all of the items on the right have the tags:

<option value="5"><span class="views-field-uid"> <span class="field-content">content</span> </span></option>

whereas the correct ones only have the option tag:

<option value="6">content</option>

If you move them back to the other side it stays the same way. Also, after saving the changes persist and look fine. I'm using this in a node reference view.

attheshow’s picture

Status: Active » Postponed (maintainer needs more info)

What do you mean when you say you're using it "in a node reference view"? I ask because those span tags look to me like they might be coming from the Views module.

twistor’s picture

My mistake, it's actually a view of flagged users. I think the problem may be that the users are normally displayed as links.

attheshow’s picture

Ok, I'm still unsure of how to duplicate what you're seeing. You'll have to describe how I can recreate your problem in a test environment.

emilymoi’s picture

If you setup multiselect to use a selection view, the view will embed html into each row, therefore causing multiselect to show the rows with html. The solution is to create a custom view fields template that just prints the row and no html.

attheshow’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
mattgilbert’s picture

Status: Closed (fixed) » Active

i'm using multiselect on a node reference field and a simple view with two fields, Node:Type and Node:Title. When I save the field, then go back to edit, the saved values appear as :

<span class="views-field-type">....</span>

(There are actually many span tags, one for each field in your view.)

I guess it's the html that the view is generating, but the span tags and everything are visible. Is there a setting in views that I'm missing that makes it work with multiselect?

To recreate, in CCK create a content type with a field of type "Node Reference" (must have Nodes Reference module activated), using the multiselect widget, and allow unlimited values. Create a view for the multiselect, and set the multiselect widget to use that view. Create a node with some other nodes selected in the multiselect. Save the node, then go back to edit it. For me, the "Selected Options:" list has tags for each option.

attheshow’s picture

Assigned: Unassigned » attheshow
Category: bug » support
Status: Active » Fixed

The solution to this problem is in comment #9 above. You need to tell your view to not add the span tags. Click on "theme information" when you're looking at your view for more information on this.

mattgilbert’s picture

Thanks! I got thrown off because I was trying to override the fields instead of the row. Overriding the views templates for fields only effects the "Available Options" select list for me, not the "Selected Options" select list. Templating the row did work though, so thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

jonathan_hunt’s picture

Category: support » feature
Status: Closed (fixed) » Needs review

I ran into this problem, also using a view to populate the select list. The view wraps the data in numerous tags, but it's a pain to have to theme the view just to make it work in multiselect.

My suggestion is to strip the tags in in the option widget rendering.

Index: modules/multiselect/multiselect.module
===================================================================
--- modules/multiselect/multiselect.module	(revision 14277)
+++ modules/multiselect/multiselect.module	(working copy)
@@ -163,7 +163,7 @@
   if (is_array($element['#value'][$field_key])) {
     foreach ($element['#value'][$field_key] as $key => $value) {
       if (isset($options[$value])) {
-        $selected_options[$value] = $options[$value];
+        $selected_options[$value] = strip_tags($options[$value]);
       }
     }
   }

attheshow’s picture

Status: Needs review » Fixed

Good point. I reviewed the CCK optionwidgets module code and it looks like they're running html_entity_decode(strip_tags()); on their strings, so I added that as well. Seems to be working nicely. Just committed that change to the dev version.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

5t4rdu5t’s picture

Title: Shows HTML code in select list » Shows HTML code in selected items list when using a view to select nodes
Version: 6.x-1.x-dev » 7.x-1.x-dev
Category: feature » bug
Status: Closed (fixed) » Needs review
FileSize
644 bytes

This issue happens again on the 7.x dev version. I'm posting a patch here that fixes the problem by stripping html from the widget's options, so there's no need to create any views templates.

We have tested it and works well for us.

enzipher’s picture

Status: Needs review » Reviewed & tested by the community

Hey,

I did not test the actual patch in comment #18, but the fix works.

Cheers,

botris’s picture

Confirming the bug and the solution in #18

alexweber’s picture

Status: Reviewed & tested by the community » Fixed

Thanks!

Committed in 677b20b and, strangely enough, reverted in 6e8f944 as the function which cleans up output is already preset in the _multiselect_build_widget_code() function.

What this means is that the dev release and any subsequent official releases will be working fine as far as this issue goes.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

ntsekov’s picture

Issue summary: View changes
FileSize
439 bytes

I have created a patch for 7.x-1.11 version.

ntsekov’s picture

I thinks it is better if we change filtering in _multiselect_allowed_values_filter_html. I have created a patch which will render properly.