Jump to content

InputfieldChosenSelect


LostKobrakai

Recommended Posts

Just thinking out loud if you are looking for something to do :)

As if I didn't talk about other modules on the todo list in another thread. But actually it's not an inputfield which is bound to be used with FieldtypePage, as this states in the module declaration.

... extends InputfieldSelectMultiple implements InputfieldHasArrayValue

The module does add itself automatically to be usable with pages in the settings of FieldtypePage, so maybe it's only missing it's entry in FieldtypeOptions' settings. I'll test this tomorrow and if it's that way, I'll add the addition/removal to install() and uninstall().

  • Like 2
Link to comment
Share on other sites

I've just checked, the module does work out of the box with FieldtypeOptions, so nothing to do for me :)

Edit: At least for the "Interface".

Seems like Ryan did not include an option for adding new options from the inputfield by now, like it's for FieldtypePage. The thing I don't like about including it myself is, that I can't really guess a value for the field, while this would give the ability to change the wording afterwards, even if it's only a typo. Maybe we should first ask Ryan if he could implement a standartised way for auto values, then it would be easy to include a "add option" field like for pages. I'll open a feature request over on github.

  • Like 3
Link to comment
Share on other sites

  • 2 weeks later...

Just a quick note - there seems to be a bit of an issue on touch screens. Not sure if it is something related to your module, or the chosen library itself, but the first time I tap on the field, it automatically selects and adds the first page to the list of selected items. After that I can tap again and no selections are made. 

This happened to me on Chrome on iOS, but I haven't tested other browsers/devices.

Link to comment
Share on other sites

Interesting - chosen actually works on tablet sized devices, but is disabled on phone sized ones. The issue I mentioned above doesn't seem to be an issue on Safari on tablets.

Having this not work on phone sized devices though is quite a problem - the selection of existing pages works well enough, but not being able to add new ones is a deal breaker for me. 

I haven't tried it yet, but there is this fork of chosen that claims to work with mobile devices:

https://github.com/rafalenden/chosen

Maybe your module could fallback to ASM select with a textarea (for creating new pages) if on phone sized? Or maybe some other option - there has to be a cleaner way :)

Not sure the best option yet - will think about it more later.

Link to comment
Share on other sites

  • 1 month later...

I've just added a new version of the module on the dev branch. A request for a single select inputfield powered by the chosen library came up on github. So I implemented it, which does mean the current inputfield is renamed to …SelectMultiple. I still want to add some more fitting styles, but it would also be nice to have some feedback if everything is still working for you guys, before I merge it to master.

  • Like 2
Link to comment
Share on other sites

I love this field type. A user of mine needs to select several pages from 100s and the tree traversal wasn't quick enough to be practical. One thing we do miss iS the ability to reorder chosen pages like the regular page select.

Is that on the horizon?

Link to comment
Share on other sites

The drag and drop reordering works lovely. Thanks for letting me know.

Can I just chip in some thoughts? 

  • This is just a personal preference but I wonder if the selected items should matched the display of the normal Page Select results.
    IE stacked vertically with 100% width, trash icon and colored background. Then again, your way fits more selections into a smaller space.|
     
  • I wonder if the drag and drop could be refined a little. When I drag a selected page left or right, I see a dotted line which I don't think is necessary. It's also only 70% height of the field too which makes it look like a mistake. It's probably a part of the original jQuery setup?
     
  • Chrome has an annoying habit of trying to auto-fill the results and bringing up a selection of 'helpful' results.

But really, thanks for taking time to make this. It's a really cool field and my users will love it.

Link to comment
Share on other sites

One more thing. This may not be part of your Module but when I save a page with the Chosen Select field, I get some weird formatting. See top left of screen and specifically the UL ID of:

<ul id="notices" class="ui-widget">
<li class="ui-state-highlight NoticeMessage ui-priority-secondary NoticeDebug"><a class="notice-remove" href="#"><i class="fa fa-times-circle"></i></a><i class="fa fa-gear"></i> Session: Change: Company_Selector_2</li>

post-1166-0-04386400-1427724109_thumb.pn

I think the width here needs to be 100% and not 100px?

.ui-state-highlight.ui-state-highlight {
  top: 0;
  background: rgb(240,240,240);
  margin: 3px 5px 3px 0;
  padding: 0;
  border: 1px dotted gray;
  width: 100px;
  height: 19px;
}
Link to comment
Share on other sites

This thing is supposed to be the ghost element while drag-and-droping a tag. Congrats jQuery UI... I'll see if I can namespace this thing somehow. 

Edit: it's fixed for the dev branch. Will push it to master as soon as I've included a defaultAdminTheme.css as well. 

  • Like 1
Link to comment
Share on other sites

Is it possible to allow users to add pages by typing in something but still only show the same pages as before in the drop down?

For example I have "foo" and "bar" as pages which get shown in the dropdown. Now user1 types "lorem". So a page called "lorem" get created.

Now user1 creates a new page. The drop down should only show "foo" and "bar" and NOT "lorem".

Maybe if "lorem" would be "hidden" the drop down could exclude it... Could you add this as an option? Like: "make auto-created pages hidden to prevent them from appearing in the list"?

Link to comment
Share on other sites

While the new page is in the dropdown it should be grayed out and unselectable as it's already selected. So what's the problem with showing it? I don't think there's an easy option to to hide them as the chosen library is automatically build from a multiselect input which does not have any modifiers. I've tried to add destinct styling to new pages before and found no good way to do this.

Link to comment
Share on other sites

What I want to archive is that you have like ten constant suggestions but still can add your own tags which should be saved but not appear in the drop down list. Maybe I have to change it a little than :/

Or is there another way to archive that?

Link to comment
Share on other sites

Maybe the easiest way to solve this would be with some custom js logic, as your subselection needs to be in another selectfield as your saved values (which include added pages). Otherwise I'd look into other libraries as chosen is really trying to act like real selectfields.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...
  • 3 weeks later...

Thanks for this great module. It works perfectly together with my FieldtypeSelectExtOption.

I use it also with new Core Module Options. Is there any chance to provide the ability to add options via the Inputfield, like adding pages if used together with FieldtypePage? I know it is more on Ryans side to provide this in his Module. Maybe there is a possibility of an approach from your side too?

Link to comment
Share on other sites

Exactly what I am looking for. :) Since new page will be created by method renderAddable() in class InputfieldPage and not in FieldtypePage it would be maybe more on the Inputfield side to offer this feature. Especially in case of InputfieldChosenSelect it would be great to have it.

Link to comment
Share on other sites

  • 5 months later...

I'm probably overlooking something basic but I can't get this to work. I've located the plugin in the modules directory - installed it on the modules page (no strikeout line any more through Input Chosen Select and Input Chosen Select Multiple). Then when I go to add a new field - but Input Chosen Multiple doesn't appear in the select box for field type.  What am I missing?  (ProcessWire 2.6.1) - jquery-1.10.2.min.js located in templates>scripts

Thanks in advance (feeling very stupid)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...