kater Posted May 24, 2022 Posted May 24, 2022 I'm doing it wrong again. ? I've a nested repeater. event_setup_list (repeater) > event_setup_list_groups (repeater) with page references (asm) ONLY when i'm iterating (even without doing anything within the first iteration) in ready.php to build an array in a php session: foreach (wire('pages')->get($_SESSION['user']['event_select'])->event_setup_list as $key1 => $item1) { } 1) Changing title field in BACKEND of event_setup_list: not saved but no error msg. 2) Changing item order (Backend) in event_setup_list_groups: Error msg: PagesEditor: Fehler beim speichern von Feld "Event Anmeldeliste" — Can’t save page 2787: /admin/repeaters/for-field-388/for-page-2212/1646045250-8328-1/: Call $page->of(false); before getting/setting values that will be modified and saved. [event_setup_list_groups] 3) I can edit everything just fine from the tree > admin > repeaters > event_setup_list > basepage > testgroup (2787) ! The repeater-containing basepage has been duplicated but all settings seem correct. The repeater is within a fieldset. All PW/Module versions current. PHP 7.4.29 Any hints? Thanks!!
elabx Posted May 24, 2022 Posted May 24, 2022 Before editing/saving any repeater item call: $item1->of(false); $item1->title = "new title"; $item1->save(); More info here: https://processwire.com/api/ref/page/of/ Repeater items are themselves RepeaterPage objects which is a class that inherits from Page, hence the formatting flag applies too. 1
kater Posted May 24, 2022 Author Posted May 24, 2022 Hi elabx, Thanks. Maybe you can give me a hint to understand why i need to set of(false) (in template) when not editing (setting values/saving to) the repeater field (via API/Template). Error happens just by iterating through the field (base repeater event_setup_list, not even the nested event_setup_list_groups). Does this already invoke editing? I can edit the repeater via admin tree section direct access without problem. cheers
elabx Posted May 24, 2022 Posted May 24, 2022 1 hour ago, kater said: Thanks. Maybe you can give me a hint to understand why i need to set of(false) (in template) when not editing (setting values/saving to) the repeater field (via API/Template). Error happens just by iterating through the field (base repeater event_setup_list, not even the nested event_setup_list_groups). Does this already invoke editing? Iterating for output shouldn't be an issue, could you post a more complete code sample?? I only see an empty for loop on your previous post.
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