Jump to content
Sign in to follow this  
MarkE

Multiple select field with choices dependent on a page reference?

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...