LostKobrakai

InputfieldChosenSelect

Recommended Posts

wilsea    27

Thanks LostKobrakai,  I was trying to make it work with a Text Field instead of a Page Field. :-[  Working like a charm and I love it.  Thanks again.

Share this post


Link to post
Share on other sites
kixe    809

# Small Note
Installing the module via Somas ModulesManager (Lightbox) will only install InputfieldChosenSelect but not InputfieldChosenSelectMultiple. Would be helpful to have a note in the description and/or the error note (if InputfieldChosenSelect is selected for a multi Page Field) that this should be done manually.

Share this post


Link to post
Share on other sites
LostKobrakai    4,313

Updated the module with a newer chosen release (security related) and fixed the hardcoded admin location in the warning about wrongly configured fields.

@kixe

There's already a warning if you're using a multi-page field with the wrong inputfield (because it changed from the first versions of the module). I've added a note about installing it beforehand. But there's also no * in the inputfield select for the field, which should indicate that the inputfield is not meant to be used for a multi page field.

  • Like 1

Share this post


Link to post
Share on other sites
valan    87

@LostKobrakai - see issue here: https://processwire.com/talk/topic/13164-http-error-500-when-opening-some-template-pages/

Described issue happens when script reaches allowed memory limits. I guess it is because ChosenSelect fails to handle too much pages (20000 pages in m case). Anyway, when I've changed inputfield to PageAutocomplete - issue dissapeared.

Share this post


Link to post
Share on other sites
LostKobrakai    4,313

That's expected. The chosen library was created to be a seemless enhanced select field (meaning it will be fully useable without js), which is why it does not have any ajax capabilities and therefore has the same problem as all other non ajaxy inputfields when loading a ton of pages.

  • Like 1

Share this post


Link to post
Share on other sites
Macrura    2,150

Just a heads up that the newest version (ProcessWire 3.0.22 devns) breaks some things, one of which is module settings fields on some modules, this being one of them (the Placeholder Text field will not save any value). (Still looking into the cause and hope to discover fix soon as it also affects my inputfield modules).

**This is now fixed in 3.0.23 devns**

Edited by Macrura
issue resolved
  • Like 2

Share this post


Link to post
Share on other sites
bernhard    1,328

thank you lostkobrakai, awesom module!

suggestion: could you add a css rule that hides the select input right from the beginning? it is hidden afterwards via jquery anyhow but as long as it is visible it leads to some ugly display of the unstyled select field.

do you understand what i mean? :)

Share this post


Link to post
Share on other sites
LostKobrakai    4,313

Chosen is a progressive enhancement for the plain select, which is why it doesn't do anything to the select until it's started by javascript. That behaviour is on purpose.

Share this post


Link to post
Share on other sites
bernhard    1,328

hi lostkobrakai,

i think you didn't get me... see this screencast. i think it is much nicer to hide the select via css (after the reload) than having it show up and hide it afterwards:

chosen.gif

anyhow... if you do not like this enhancement i'll just leave my line css in place. but i don't see a reason not to add this by default for every chosen input field

#Inputfield_my_chosen_select { display: none; }

 

Share this post


Link to post
Share on other sites
LostKobrakai    4,313

I fully understand. Hiding the select essentially means the input is unusable if javascript does not work for whatever reason. That's exactly what you want to prevent with any progressive enhancement. It's true, that in the context of the backend it might not be a pressing issue, but I'm not really convinced that showing nothing before js kicks in is much better than showing the original select field. There will always be a layout update.

Share this post


Link to post
Share on other sites
tpr    2,229

Well you could hide with CSS add a CSS animation to unhide after a few seconds, which would ensure the select to be visible (in theory). Because of the few seconds delay the JavaScript will probably make changes to the DOM so the original select won't be visible. I've used this tecnhique in a site with a loader, to remove the loader even if there's something with JavaScript.

Anyway, I think this kind of FOUC doesn't matter too much in an admin.

  • Like 1

Share this post


Link to post
Share on other sites
LostKobrakai    4,313

I'm not sure if it works correctly, but by a quick glance in the code FieldtypeSelectExtOptions should let you choose InputfieldChosenSelect if installed.

  • Like 2

Share this post


Link to post
Share on other sites
cyberderf    1
20 hours ago, LostKobrakai said:

I'm not sure if it works correctly, but by a quick glance in the code FieldtypeSelectExtOptions should let you choose InputfieldChosenSelect if installed.

Nice, I am installing the module right now!

How come it cames in 2 separates modules? I see  InputfieldChosenSelect and InputfieldChosenSelectMultiple in my new modules list.

Share this post


Link to post
Share on other sites
LostKobrakai    4,313

I'm not sure what exactly you mean. It should show the selectable items and filter them if you start typing.

Share this post


Link to post
Share on other sites
neonwired    1
7 minutes ago, LostKobrakai said:

I'm not sure what exactly you mean. It should show the selectable items and filter them if you start typing.

oh yeah, i was expecting to see the search bar and icon but that's only on single selects not multiple.

Share this post


Link to post
Share on other sites
noelboss    7

Is it somehow possible to use this in the frontend? (I'm new to PW, sorry for the question) .

Feature Request: Also, i have the multiple field using pages that have children (nested categories). Would it be possible to visually clarify this relation? Right now all the pages are listed (which is a good thing) but the user can't tell the difference between main categories and sub categories…

BTW, love your module, it's the easiest to use to select relations imho.

Share this post


Link to post
Share on other sites
Zeka    282
16 minutes ago, noelboss said:

Is it somehow possible to use this in the frontend? (I'm new to PW, sorry for the question) .

Feature Request: Also, i have the multiple field using pages that have children (nested categories). Would it be possible to visually clarify this relation? Right now all the pages are listed (which is a good thing) but the user can't tell the difference between main categories and sub categories…

BTW, love your module, it's the easiest to use to select relations imho.

Hi @noelboss

You can play with "Label field" options. Select Custom format and put something like {parent.title}.

Are you talking about front end editing? 

 

Share this post


Link to post
Share on other sites
noelboss    7

Then i will also get the parent of all categories, and it's still not visually clear:

  • Categories - Cat 1
  • Categories - Cat 2
  • Cat 1 - Child Cat 1

I'm talking about using the input type in the frontend for editing yes, like in a firm that I build and using the type as input. I'm no yet sure how to do it the PW way.

Share this post


Link to post
Share on other sites
Macrura    2,150

Frontend editing implies the native processwire functionality for that, not apropos building your own forms;
when you build your own forms you can use any jquery plugins that you want, so you can just load the chosen assets and init the field on your form.

Share this post


Link to post
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


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Marc
      I am trying to make a simple wiredata module that lets me select a page I want all visitors to be redirected to. I have this working in ready.php but then I decided on putting it in a module and I can't get it to work. Here's the relevant bits:
      public function ready() { $this->addHookBefore('Page::render', $this, 'redirectUsers'); } public function redirectUsers(HookEvent $e) { $page = $e->object; // The page we want to redirect to. $redirect = $e->pages->get($this->redirectPage); if ($page->id == $redirect->id) return; // Prevent infinite loop. if (!$e->user->isLoggedin()) { $e->session->redirect($redirect, false); // 'false' indicates 302 temp redirect. } } I left some checks out for simplification. Whenever I'm not on the page that I want to redirect to, an infinite redirect loop starts. Could anybody explain why that is?
    • By alxndre
      I just happened upon something that I think is curious, and I'm wondering if this is default behavior. So help me because I know nothing.
      While writing a module, i logged something in wire('log') inside the module's init() function. I was surprised to see that the text was being logged multiple times continuously. So I tried to open a small random module and logged something in its init() function as well, and the same thing happened - the text being logged many times.
      My question is, is this supposed to happen? I just want to understand what's going on. My concern is that if I do something huge in the init function, it will get called repeatedly, as with the log, and cause performance issue. Please note that these are both autoload modules. I was expecting them to log at least once when I refresh, but not continuously like what happened.
      Please let me know. Thanks.
    • By abdus
      I'm developing a multi value fieldtype and there's this method called getLoadQueryAutojoin().
      // FieldtypeMulti.php /** * Return the query used for Autojoining this field (if different from getLoadQuery) or NULL if autojoin not allowed. * * @param Field $field * @param DatabaseQuerySelect $query * @return DatabaseQuerySelect|NULL * */ public function getLoadQueryAutojoin(Field $field, DatabaseQuerySelect $query) { if($this->get('useOrderByCols')) { // autojoin is not used if sorting or pagination is active $orderByCols = $field->get('orderByCols'); if(count($orderByCols) > 0) return null; } $table = $this->database->escapeTable($field->table); $schema = $this->trimDatabaseSchema($this->getDatabaseSchema($field)); $fieldName = $this->database->escapeCol($field->name); $separator = self::multiValueSeparator; foreach($schema as $key => $unused) { $query->select("GROUP_CONCAT($table.$key SEPARATOR '$separator') AS `{$fieldName}__$key`"); // QA } return $query; } Why would someone need to autojoin a field, or not need a autojoin? Any benefits/drawbacks? I havent used the feature it at all in my 3+ years PW experience.
      I'm not sure whether I need to implement it but I am leaning towards returning null and disable it altogether.
    • By antoiba86
      I am a bit confused, because I don't know how to solve this problem.
      When I install the module Languages Support - Page Names, my web falls apart.
      I have all the necessary modules installed as Language support for example.
      This is the error I get in the admin panel.
      Warning: Invalid argument supplied for foreach() in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 107 Warning: Invalid argument supplied for foreach() in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 198 Warning: Invalid argument supplied for foreach() in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 1011 Warning: Invalid argument supplied for foreach() in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 1011 Warning: Invalid argument supplied for foreach() in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 1041
      And this in the front-end.
      Warning: Invalid argument supplied for foreach() in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 107
      Fatal error: Call to a member function get() on null in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 605 Fatal error: Call to a member function get() on null in /hosting/www/antoibaprogramming.com/public/wire/modules/LanguageSupport/LanguageSupportPageNames.module on line 605
    • By kongondo
      The Module Blog for ProcessWire replicates and extends the popular Blog Profile.
      Blog is now in version 2.
      Please read the README in the Github link below in its entirety before using this module 
      Blog Documentation is here (Work in Progress!)
      See this post for new features in version 2 or the readme in GitHub.
      To upgrade from version 1, see these instructions.
      ##################################################
      Most of the text below refers to Blog version 1 (left here for posterity). 
       
      Blog version 1 consists of two modules:
      ProcessBlog: Manage Blog in the backend/Admin.
      MarkupBlog: Display Blog in the frontend.
      Being a module, Blog can be installed in both fresh and existing sites. Note, however, that presently, ProcessBlog is not compatible with existing installs of the Blog Profile. This is because of various structural and naming differences in respect of Fields, Templates, Template Files and Pages. If there is demand for such compatibility, I will code a separate version for managing Blog Profile installs.
      In order to use the 'Recent Tweets Widget', you will need to separately install and setup the module 'MarkupTwitterFeed'.
      Please read the README in the Github link below in its entirety before using this module (especially the bit about the Pages, etc. created by the module). 
      I'll appreciate Beta testers, thanks! Stable release works fine.
      Download
      Modules Directory: http://modules.processwire.com/modules/process-blog/
      Github: https://github.com/kongondo/Blog
      You can also install from right within your ProcessWire install.
      Screenshots (Blog version 1)

      Video Demos
      ProcessBlog
      MarkupBlog
      Credits
      Ryan Cramer
      The Alpha Testers and 'Critics' 
      License
      GPL2