guy Posted June 13, 2023 Share Posted June 13, 2023 I'm looking to change the visibility of child fields within a repeater based on the value of a field on the owner page (the page on which that repeater appears). To illustrate: Owner (Page) - type (select field) ---- type_one (option) ---- type_two (option) - things (repeater field) ---- thing_one (child field) ---- thing_two (child field) With the above set up, when you select type > type_one then within the repeater the visibility of things > thing_two would be set to hidden. I don't mind how I go about doing this - at present I've tried the following hook within ready.php: $wire->addHookAfter('ProcessPageEdit::buildFormContent', function (HookEvent $event) { $page = $event->object->getPage(); $form = $event->return; $thingsField = $form->getChildByName('things'); ... // but past this point I haven't been able to select $thingsField child input fields }); The above gets me access to an InputfieldRepeater as $thingsField but I'm not sure how to then drill down into its child input fields. If I could get access to child input fields I'd then assume I can set showIf to a nonsense value to hide the field, i.e. $childInputField->showIf = 'true=false'; Any help with the above would be much appreciated. Link to comment Share on other sites More sharing options...
gs-df Posted June 13, 2023 Share Posted June 13, 2023 I think u can solve it with this modulehttps://processwire.com/modules/custom-inputfield-dependencies/ 1 Link to comment Share on other sites More sharing options...
guy Posted June 13, 2023 Author Share Posted June 13, 2023 @gs-df thank you so much for the recommendation - just plugged it in and it does exactly what I need. @Robin S thank you as well for your work on this module. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now