Jump to content

Multiple select field with choices dependent on a page reference?


Recommended Posts

Posted

I am trying to provide a multiple select field where the choices will depend on the contents (of a field or sub-pages) of another page but can't see how to do this.

To summarise the situation:

  • I have a template called BookableSlot which contains details of an event.
  • I have another template called Booking, the pages of which are children of a Membership page (which can cover a group of co-members).
  • The Booking template has a page reference field linked to a BookableSlot page
  • When a member books themselves (and possibly others in their membership group) on an event a new Booking page is created using details from the chosen BookableSlot page (including the link-back).
  • This works fine when just simple text fields etc. are copied across to the Booking page.
  • Now I want to add a repeater field (one for each member in the membership group) to the Booking page:
    • Each repeater field is to contain a title field and a multiple select field.
    • I want the multiple select field to be based on some data in the referenced BookableSlot page - maybe either a multi-line text field, a repeater field or child-page titles, whatever works best.

I just can't get my head round how to do this in ProcessWire. A select options or page reference field would only give a fixed set of choices, whereas I want the choices to be dependent on the referenced BookableSlot page.

Many thanks for any ideas.

Posted

After having slept on this I realise that the answer is probably to set up child pages of each BookableSlot page and then use a field with a 

InputfieldPage::getSelectablePages

hook.

 

 

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.
×
×
  • Create New...