back to phpList.org

Segment Plugin Pulldown too short

Sorry for my English.
The segment plugin (2.7.0+20181115) works fine, but in the pull down menues the value of the field ‘name’ of the table ‘user_attribute’ is cut off with a lenght of 20 characters.

Mitgliedsbeitrag 2001
Mitgliedsbeitrag 2002
Mitgliedsbeitrag 2003
Mitgliedsbeitrag 2004

is displayed as

Mitgliedsbeitrag 200
Mitgliedsbeitrag 200
Mitgliedsbeitrag 200
Mitgliedsbeitrag 200

and therefore somehow useless :wink:

Any hint, where I can find this in the code is strongly appreciated!

@ErnstZlo can you show a screenshot of the problem?

That’s ok I can repeat it myself

image

Thank you for the prompt reply, I’m out of office and by now at home.
I made some ugly quick and dirty bypass and wrote a replacement for the empty pulldown in the last line. So when first choosing, the whole length is available.
But the problem remains that, when using more of them you have no chance to cross check them.
Where do you cut the string? I could not find a substr in the whole plugin.
Best regards

@ErnstZlo It is this section of code in file depends.php

'ConditionFactory' => function (ContainerInterface $container) {
    $daoAttr = new Attribute(
        $container->get('phpList\plugin\Common\DB'),
        20,
        0
    );

You can change 20 to some larger value. My original reason was to restrict very long attribute names because they would not display nicely. I will review this to either make it configurable or remove it entirely.

You are the best, thank you very much!
Problem solved!

And I go and kick myself, because I didn’t search for ‘20’ which - as always afterwards - seems logical … now it’s 128

FYI the problem seems the German Language, which combines normal words to constructs like:
Donaudampfschiffahrtsgesellschaft
Which would be …
Danube steam boat Ltd.

If you think this is an extreme example, look at the screenshot. :wink:

The field Vorauswahl is an Idea from me, because when confronted with a pull down containing 200 or more items I make a search within the attributes and display the matching {LIKE ‘%vorauswahl%’} for a slim pull down.

@ErnstZlo There’s a way to filter the select list

add an extra class to the select list, file admin/plugins/SegmentPlugin.php line 463

        array('prompt' => $selectPrompt, 'class' => 'autosubmit searchable')

and attach that to select2 in file admin/plugins/SegmentPlugin/script.html line 22

$("select.searchable").select2({
});

See whether that works for your use case.

It works perfect.
But may I ask you for chanching your post?
The extra class searchable on line 463 has to be added in the file SegmentPlugin.php (in the directory plugins) :grin:

And no, I didn’t search fort it that long, but had other severe problems …

Again THAN YOU VERY MUCH, Duncan.