Jump to content

dewwwald

Members
  • Posts

    28
  • Joined

  • Last visited

Community Answers

  1. dewwwald's post in Reapeater reference breaks after changes are made to a used repeater field. was marked as the answer   
    Does not solve the issue, I have a workaround.
    Clearly this adventure was as a result of a lack of knowledge. As part of the splution I will explain what I have done and what the workaround was. LostKobrakai has stated:
    This means that you should avoid inputfields in repeaters as far as I can gather.
    The use case
    Lets say I have a template that I call resources, this page has some basic content and also a repeater. The repeater Item can either be used for navigation to an internal page or a file that is uploaded and downloaded. So we want the user to lose or gain functionality based on what he or she wants the repeater to do. For instance we want page to show only if file is blank and we also want file to show only if page is blank. So one or the other will be used and not both.
    The broken solution
    Adding this here for the sake of completeness.
    I originally thought I would solve this issue by adding two checkbox fields to the repeater and have page and file hidden if their checkbox is not selected. Even more have the checkbox that shows the other field hide when the first checkbox is selected. I did this by using the 'hide only if' functionality found in processwire on the input tab of each field. There I simply added a condition 'checkbox=0' for the checkboxes and 'checkbox=1' for the field relating to the specific checkbox. Though this is a good solution that looks nice in admin. Its the very same thing that breaks repeaters. I think it might have been the page field having a condition.
    A work around
    My solution to this is to simply add the page and file field. Have the file field hide when page is populated (this does not work on page selector fields). Now have my php output the page field markup if it has an item else ill output the file field markup.
×
×
  • Create New...