Jump to content

PageField – limit number of choices


a-ok
 Share

Recommended Posts

16 hours ago, tpr said:

I reckon the same question is about to emerge for the rest of the PageField types, isn't it? ?

Would be cool to add support where possible. :)

Not sure how you've handled the AsmSelect limit in the as-yet-unreleased AOS update, but maybe part of the JS could be broken off into a piece that is generic to all Page Reference inputfields. It would identify the underlying form element that contains the actual field value, and on change it would check if the limit is reached. If so it would add a class to inputfield container, and trigger some event for the container, e.g. 'limitReached'.

If you go that way others can contribute pull requests for the remaining Page Reference inputfield types without reinventing the wheel for the limit check. I'd be happy to contribute here.

  • Like 3
Link to comment
Share on other sites

  • 1 month later...
On 2/22/2018 at 10:31 PM, tpr said:

It's done, will be added to the next aos update.

Hi @tpr,

Wonderful, elegant solution. I need this for my current project but I don't understand how I can get it. Have you made a module? Is it available?

Thanks!

Link to comment
Share on other sites

It works with asmSelect type only (atm). 

Install AdminOnSteroids module, enable AsmTweaks at the top, then scroll down to its config section (or click the "cog" icon in the AsmTweaks block's bottom-right corner to jump there). Here check "Add limit to AsmSelect" and save AOS. Finally, in your field's Input tab set the max number in the "Max limit of items" input field .

https://github.com/rolandtoth/AdminOnSteroids/wiki/AsmTweaks

  • Like 2
Link to comment
Share on other sites

  • 2 months later...
On 2/23/2018 at 6:26 AM, tpr said:

I saw this follow-up question coming, ? I think that's also doable, will check that later. I reckon the same question is about to emerge for the rest of the PageField types, isn't it? ?

Regarding Page Auto Complete fields I have the impression there already is a limit. In several templates I have a page field referring to a list of over 4000 places. When I want to add 'Paris, Île-de-France, France' from the list, that doesn't show up because the page are sorted alphabetically and the Page Auto Complete list starts with 'Paris Ier, Île-de-France, France || address 1', then 'Paris Ier, Île-de-France, France || address 2' and so on, then 'Paris IIe, Île-de-France, France || address 1' and so on. The list stops before just 'Paris, Île-de-France, France' shows up alphabetically.

It's ok to find other places in Paris because part of the street name will do in the Page Auto Complete field, but it's just not possible anymore to add 'Paris, Île-de-France, France'. Changing the Autocomplete search operator doesn't work for what I want either (still searching by other parts of the address).

This all happens in the admin pages, no front editing.

Link to comment
Share on other sites

  • 2 weeks later...
On 7/2/2018 at 11:26 PM, BFD Calendar said:

It's ok to find other places in Paris because part of the street name will do in the Page Auto Complete field, but it's just not possible anymore to add 'Paris, Île-de-France, France'.

If I'n not wrong, @kongondo's VisualPageSelector module (commercial) should solve such an issue as it uses lister and its filters to select the related page:

quote: "electable pages as per page field settings + Lister filters"

see more: 

Or you might want to implement your own InputField which also uses ProcessWire's Lister and its user customizable page filter to select the page.

 

  • Like 1
Link to comment
Share on other sites

3 minutes ago, bernhard said:

@BFD Calendar you can also use RockGrid to select Pages. It should be able to handle 100k pages and you could even add images just like in the screenshot of kongondo's module above

Thanks for the tip, actually I tried RockGrid on another site earlier today but it was far above my capabilities to do anything with it. (I was looking for something to generate detailed reports from Padloper sales)

Link to comment
Share on other sites

1 hour ago, szabesz said:

Or you might want to implement your own InputField which also uses ProcessWire's Lister and its user customizable page filter to select the page.

 

I've used Lister before but didn't know it could also be used to make a custom InputField....

Link to comment
Share on other sites

33 minutes ago, BFD Calendar said:

Thanks for the tip, actually I tried RockGrid on another site earlier today but it was far above my capabilities to do anything with it. (I was looking for something to generate detailed reports from Padloper sales)

Sorry to hear that. It's all about using the right RockFinder and sometimes it's easier/necessary to populate hidden fields with hooks to efficiently query the data. Did you try RockFinder Tester? Once you have the right RockFinder you can do everything that aggrid can do.

Using it as a page selector needs some additional (but not complicated) javascript, though.

  • Like 1
Link to comment
Share on other sites

I tried RockFinder Tester as well, but didn't find my way as I want either. I'm just an amateur programmer but nevertheless happy with ProcessWire capabilities for my needs as far as it gets. My main job is managing an Academic Design Workshop for 1500 students. The website (www.mekano.info) is just a side project next to operating lasercutters, CNC routers, a wide range of hand tools, and painting the studio floor during school holidays.

  • Like 1
Link to comment
Share on other sites

  • 3 years later...

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
 Share

×
×
  • Create New...