Jump to content

Two separate fields with one and the same dbtable as data source


seddass
 Share

Recommended Posts

Hi all,

Hope someone could help me.

Is there an easy way to have two "Page" fields with the same dbtable as data source? All of the settings of the both "Page" fields are equal except:  first is "Checkboxes" and the second is "ASMSelect" or PageListSelectMultiple type.

The reason of this weird idea.. is the client requirement to select the items from a full list with checkboxes with an option for changing the items show order.

My idea was to have the two fields mentioned above in one page, attached to one dbtable. The client will select the items with checkboxes and after save he could change their show order as the selected items will be selected in "ASMSelect" field too.

If it is important.. the count of the current items is aprox. 100 and will grow slowly. The client doesn't like the PageListSelectMultiple or ASMSelect method of selecting the items because not all of the items are listed at once.

Probably there are more great ideas. :)

Please, advice.

Thanks

Update:

Have realized that saving "Checkboxes" field will overlap and reset the show order of the items reordered from ASMSelect field.

Link to comment
Share on other sites

If I'm understanding correctly, your client actually wants sortable checkboxes?

There is not a way to create two fields and have them share the same data.

I should say that 100+ checkboxes is usually considered a problem from an interface perspective. Such a solution can't scale forever and at some point you'll just run out of memory (though, you'd have to scale quite a bit larger before that became a problem). For something that is going to keep growing, you need some form of pagination in there. The PageListSelectMultiple is something that will scale indefinitely and it does support sorting. I don't know of any other solution (in or outside of PW) that supports that scalability and sortability together in one field.

If you wanted to create sortable checkboxes, you could always create a new Inputfield type for ProcessWire, and use it along with the Page reference fieldtype. This would require getting into some PHP and deeper into the PW API, but it is doable and we're always here to help you figure it out. If you go this route, I would probably use the InputfieldAsmSelect module as a starting point to adapt from.

Link to comment
Share on other sites

Thanks Ryan!

Yes, the client would like something similar to sortable checkboxes. I totally agree about the issues related to "unlimited" checkboxes in one page and there is no doubt that PageListSelectMultiple is much better solution. Will try to duplicate the select multiple items with checkboxes and to keep as closer as I can to ASMSelect!

Link to comment
Share on other sites

Isn't PageListSelectMultiple with parent defined pretty much perfect solution here? It does require one click for editor, but I see that as a superior solution for 100+ checkboxes.

To get "one click" just edit Page List module and add "Number of pages to display before pagination" to 200 or whatever you think is maximum. This of course affects other parts of the admin also (small side effect here, but I assume your client likes to see lot of pages at a time ;)).

Link to comment
Share on other sites

This is one area where costs speak louder than words. Give them an estimate for your time on how long you think it will take to invent a new sortable checkbox field type, then give them the cost for using something that already exists and is designed for this purpose. I have a feeling they will be enthusiastic about learning how to use the new field. :)

Link to comment
Share on other sites

Well.. I think I have created a new Inputfield with multiple checkboxes and sort option based on asmSelect. I think there is room to improve and probably I will upload a new revision soon but it could to be used as it is now.

The module cold to be placed in modules folder and after installation it should to be included in Page module => "Inputfield modules available for page selection".

InputfieldAsmSelectCheckboxes_v1.zip

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...