Ivan Gretsky Posted September 4, 2015 Share Posted September 4, 2015 (edited) Good day! I am exhausted trying to get it working on my own so begging for help) I made a frontend form to edit a page. When the form is submitted, I get all the values for the fields from the input, get the required page in $_page variable and assign inputs to the fields. After that I perform $_page->save(). All simple fields get saved as they should. Dealing with page fields I remove all the pages in the array and add the new ones from the input like this: $_page->pagearray->removeAll(); foreach ($input->post->pagearray as $item) { $_page->pagearray->add($item); } In the case of $_page->save() id does not save. But if I do $_page->save('pagearray') it does. I think it is not the right thing. Probably I am doing something wrong, but I can't figure out what. Please be so kind to help! Edit: Corrected the code Edited September 4, 2015 by Ivan Gretsky Link to comment Share on other sites More sharing options...
adrian Posted September 4, 2015 Share Posted September 4, 2015 Hi Ivan, I am still half asleep, so might be completely off here, but you are doing a removeAll on "chalet_dining" - given that, should you be doing: $_page->chalet_dining->add($item); rather than: $_page->pagearray->add($item); Link to comment Share on other sites More sharing options...
Ivan Gretsky Posted September 4, 2015 Author Share Posted September 4, 2015 Sorry, it is I who is half asleep. I was trying to make my example abstract. I will change the code in my initial post. The problem is not in the typo. 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