vmo Posted September 9, 2017 Share Posted September 9, 2017 HI, I am trying to use the Inputfield Chosen Select Multiple in a page reference field that is used in a repeater and when I add a new items to the repeater the multiple select is not rendered, it only shows a multiple select box. I think that the javascript code that renders the field is not triggered after the Ajax load because when turning off the Ajax functionality. Is there a way to make it possible to render the field in a repeater? Thank you Link to comment Share on other sites More sharing options...
Macrura Posted September 12, 2017 Share Posted September 12, 2017 I just forked the module and added support for repeaters (only on the multi select inputfield for now); it basically involves 2 steps - changing the module code to use mostly the renderReady method instead of render(), and then some small update to the js file to init the field on the necessary events, which for the sake of brevity also involves moving the init code into its own function var... I submitted a pull request; in the meantime if you need this to work now, you can try the forked version https://github.com/outflux3/InputfieldChosenSelect 4 Link to comment Share on other sites More sharing options...
LostKobrakai Posted September 13, 2017 Author Share Posted September 13, 2017 I've just merged the changes of @Macrura. 2 Link to comment Share on other sites More sharing options...
kixe Posted September 13, 2017 Share Posted September 13, 2017 Small CSS Border (left) issue using UIKit AdminTheme Link to comment Share on other sites More sharing options...
Macrura Posted September 13, 2017 Share Posted September 13, 2017 adding this to the multi's css file fixes it: .AdminThemeUikit .chosen-container:not(.chosen-container-active) { position: initial; } after more testing i can do a pull request to have that added to the module... 1 Link to comment Share on other sites More sharing options...
mel47 Posted December 19, 2017 Share Posted December 19, 2017 Hi, Do someone know a way to use ChosenSelect in form builder to use pages? A hook maybe? I just have the option to type manually text, and however I want pages (as we can use in backend). Thanks Mel Link to comment Share on other sites More sharing options...
Macrura Posted December 19, 2017 Share Posted December 19, 2017 10 hours ago, mel47 said: Do someone know a way to use ChosenSelect in form builder to use pages? A hook maybe? I just have the option to type manually text, and however I want pages (as we can use in backend). you just have to use a regular multi select, and then init that with the chosen JS on your form; In other words you wouldn't setup the formbuilder field to use chosen select, you would setup a page select multiple with a InputfieldSelectMultiple as the input; then you would config add the chosen assets from within your formbuilder.inc file in your templates folder, using either a conditional or a switch statement; you would also need to add a init js file that would init the inputfield.. (see https://harvesthq.github.io/chosen/ for examples) 3 Link to comment Share on other sites More sharing options...
mel47 Posted December 21, 2017 Share Posted December 21, 2017 On 19/12/2017 at 10:49 AM, Macrura said: you just have to use a regular multi select, and then init that with the chosen JS on your form; In other words you wouldn't setup the formbuilder field to use chosen select, you would setup a page select multiple with a InputfieldSelectMultiple as the input; then you would config add the chosen assets from within your formbuilder.inc file in your templates folder, using either a conditional or a switch statement; you would also need to add a init js file that would init the inputfield.. (see https://harvesthq.github.io/chosen/ for examples) ok thanks. I will examine this later as it not so "out-of-box" solution. Link to comment Share on other sites More sharing options...
mtn Posted February 28, 2018 Share Posted February 28, 2018 Is the module compatible with PW v. 3.0? Link to comment Share on other sites More sharing options...
V7dev Posted April 26, 2018 Share Posted April 26, 2018 On 2/27/2018 at 8:18 PM, mtn said: Is the module compatible with PW v. 3.0? Well, for future users, I'm using it on ProcessWire 3.0.98 Link to comment Share on other sites More sharing options...
LAPS Posted June 23, 2018 Share Posted June 23, 2018 On 12/19/2017 at 4:49 PM, Macrura said: you just have to use a regular multi select, and then init that with the chosen JS on your form; In other words you wouldn't setup the formbuilder field to use chosen select, you would setup a page select multiple with a InputfieldSelectMultiple as the input; then you would config add the chosen assets from within your formbuilder.inc file in your templates folder, using either a conditional or a switch statement; you would also need to add a init js file that would init the inputfield.. (see https://harvesthq.github.io/chosen/ for examples) @Macrura, I do not understand how to configure the assets from within my formbuilder.inc file in my templates folder and how to add a init js file that would init the inputfield. Can you provide some more detailed guidelines to use ChosenSelect in FormBuilder to use pages? BTW/Note: I'm using ProcessWire 3.0.98 Link to comment Share on other sites More sharing options...
Macrura Posted June 23, 2018 Share Posted June 23, 2018 @LAPS form-builder.inc: /** * * Add custom scripts to the form. * */ $forms->addHookBefore('FormBuilder::render', function($event) { $form = $event->arguments(0); $config = wire('config'); switch ($form->name) { case 'name-of-form': $config->scripts->add($config->urls->templates . "libraries/chosen/name-of-js.js"); $config->styles->add($config->urls->templates . "libraries/chosen/name-of-css.css"); $config->scripts->add($config->urls->templates . "FormBuilder/custom-js-init-file.js"); break; // other forms can be added below... } }); in your init file: $("#Inputfield_name_of_input").chosen({ no_results_text: "The planet exists not", allow_single_deselect: true, width: '100%' }); 3 Link to comment Share on other sites More sharing options...
maddmac Posted January 7, 2021 Share Posted January 7, 2021 Great module, question @LostKobrakai regarding add new tags on the fly. When I enter a tag name and press TAB nothing happens, should it add a new page automatically? Is there something I need to change in the config for this to happen? I can add existing tags no problem. Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 8, 2021 Author Share Posted January 8, 2021 The module piggy-backs on the core functionality of adding new pages on demand. Could you make sure that it works when using core inputfields? Link to comment Share on other sites More sharing options...
maddmac Posted January 8, 2021 Share Posted January 8, 2021 Quote Could you elaborate more on what you mean? Quote Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 11, 2021 Author Share Posted January 11, 2021 There is a setting for page fields to allow for pages to be added through it. Iirc in core inputfields this is a completely separate input below the actual page selection. This needs to be enabled for this module to be able to add new pages, as it's using the built in input, but just hides it and allows you to add new pages inline. Link to comment Share on other sites More sharing options...
maddmac Posted January 11, 2021 Share Posted January 11, 2021 I found this and updated, but the result is the same, it doesn't add the new tag or page. It says its going to be added but doesn't. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now