iank Posted February 15 Share Posted February 15 Hey @bernhard, RPB is so great I decided to migrate from RepeaterMatrix for a site I'm working on ? However, I came across a snag with a page reference field not saving to the DB. I have a fairly basic 'RichText' block which in addition to the basic title/textarea fields has a checkbox to show a page reference page (single page) via a showIf condition. If the checkbox is checked, the page reference field is shown: But when the block (or parent page) is saved, the chosen option doesn't get saved. I know the page reference field works, because this is exactly the same logic (using the same fields) I've ported across from my RepeaterMatrix field. Furthermore, if I disable the "showIf" condition in the RPB block, the page reference once again works correctly. In the example above, I'm using a select dropdown, but I get the same behaviour if it's a Radio Buttons list. Any thoughts? Much appreciated, Ian. 1 Link to comment Share on other sites More sharing options...
iank Posted February 15 Author Share Posted February 15 Edit: OK, I think we can ignore the dependent field types involved (page reference, Fieldset (page)) - a simple example with just a checkbox and a textarea exhibits the same problem. It definitely looks to be something related to the "showIf" condition rather than the underlying fields: ----------------- Hi @bernhard, sorry to be a pain. In fact, I have the same problem if the dependent field is a FieldtypeFieldsetPage, as in this example: This example is part of a Call to Action block. The 'Action' field is a Select Options field, and the 'Link to Page' field is the Fieldset (Page) field containing the three nested fields you can see. None of those three fields are saved when the block or page is saved. I think it must be something to do with the 'showIf' logic. Again this logic is just moved over from a RepeaterMatrix field where it worked just fine. Thx, Ian. 2 Link to comment Share on other sites More sharing options...
iank Posted February 19 Author Share Posted February 19 Hi @bernhard, I discovered some more information which might help with troubleshooting. I came across this post which seemed to be related: https://processwire.com/talk/topic/29225-solved-show-this-field-only-if-doesnt-seem-to-work/. As mentioned in that post, if I use Alfred on the front end, or choose "Edit in new window" from the admin side, the changed information does indeed get saved. Only when editing the blocks in the admin in 'repeater mode' does the 'showIf' information not get saved. I hope that points you in the right direction (and for now I have a workaround!) Thx, Ian. 1 Link to comment Share on other sites More sharing options...
bernhard Posted March 31 Share Posted March 31 On 2/15/2024 at 4:57 PM, iank said: RPB is so great I decided to migrate from RepeaterMatrix for a site I'm working on ? Hey @iank sorry for ignoring this post for so long and thank you very much for the great feedback. Really glad you like it and hope you still do ? Thx to @FireWire the latest version of RPB v5.3.2 contains a fix for that issue ? For anybody interested: The reason for the issue is that whenever a RPB item is saved we need to also process all changed items. I was doing that by adding all block-fields to an InputfieldWrapper element and then calling ->processInput($wrapper). This worked well, but it does not support showIf, as FireWire explained to me. So he changed it to use InputfieldForm instead and now everything works as expected. Let me know if everything works and please mark the topic as [solved], thx ? 1 Link to comment Share on other sites More sharing options...
FireWire Posted April 1 Share Posted April 1 Also confirmed that the fix makes it possible to use requireIf in blocks! 1 Link to comment Share on other sites More sharing options...
iank Posted April 2 Author Share Posted April 2 On 3/31/2024 at 9:28 AM, bernhard said: Let me know if everything works @bernhard, showIf conditions are now working as expected. These are working in all three edit modes: Full page edit, block "edit in new window" and front-end block edit with Alfred. However, On 4/1/2024 at 4:36 PM, FireWire said: Also confirmed that the fix makes it possible to use requireIf in blocks! This is not working for me when editing a block in full page edit mode. If a requiredIf condition is met, then none of the block's changes are persisted. When editing a block via "edit in new window" or front-end with Alfred, the requiredIf conditions work and the changes are saved. Sorry to be a pain - I think we're almost there, but I can't for the life of me figure out why this is happening only in the full page edit scenario. I can create a screencast demonstrating the issue if that would be helpful. Thx, Ian. 1 1 Link to comment Share on other sites More sharing options...
FireWire Posted April 2 Share Posted April 2 @iank I'll double check on my end, I may have not tested thoroughly enough, or got inconsistent results. Not sure about yours, but in my case the most important component was the showIf since it is the primary method of indicating the action a user should take and important way to keep the UI tidy. If you continue configuring your fields to use requireIf then any update to RPB would mean those field settings will be respected. So hopefully it doesn't slow your development too much. 1 1 Link to comment Share on other sites More sharing options...
iank Posted April 2 Author Share Posted April 2 12 minutes ago, FireWire said: Not sure about yours, but in my case the most important component was the showIf since it is the primary method of indicating the action a user should take and important way to keep the UI tidy. Likewise. It's certainly not a deal-breaker, and the showIf fix is a big step forward for my needs. ? 2 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