Jump to content

Page field does not save on $page->save()


Ivan Gretsky
 Share

Recommended Posts

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 by Ivan Gretsky
Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...