Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Uploadify Problems with Frontend Page Form


Go to End


2 Posts   986 Views

Avatar
monkeyben

Community Member, 25 Posts

14 June 2011 at 12:14pm

I am building a frontend form that can be used to add news article pages to the database. I have managed to get the form to save the page data but when I try to add Uploadify for the has_many news images, the images go into the database correctly but it messes up the page data (e.g. news data only going in news_live table, classname being set to SiteTree, Created not set, URLSegment wrong, ParentID wrong).

I have found that the news images and the news page data saves correctly, apart from the form just adding the page as a deleted page, when I use the $newsarticle->write() function so it looks like I either have something wrong or Uploadify has an incompatibility with the Versions extension (using writeToStage, publish).

Thanks for any help :)

Avatar
monkeyben

Community Member, 25 Posts

16 June 2011 at 4:17am

I changed the code to as below and that works: -

//$latestnewsarticle->writeToStage('Stage');
//$latestnewsarticle->publish('Stage', 'Live');

$latestnewsarticle->write();
$latestnewsarticle->doRestoreToStage();

The client wont be using the CMS, they will be using a custom backend.