Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Bunnynut 128 posts 310 karma points
    May 23, 2013 @ 16:00
    Bunnynut
    0

    Multitype item doesnt save content

    HI there,

    Thank you for creating this package, it rocks.

    I do have an issue with it though. I created a new datatype (called textblock) and added some properties to it.
    The new type consists of 5 properties: Tekst (Simple editor), fontsize (contentpicker), fontcolor (contentpicker), topmargin (contentpicker) and leftmargin (contentpicker).
    I've added a documenttype property and i can create a textblock item, or so it seems.
    But when i publish it, it doesnt show up in the xml. When i reopen the page in umbraco the textblock item is not there anymore.

    There are no errors at all.
    Im using Umbraco v6.0.4

     

    Thanks in advance

  • aghy 129 posts 308 karma points
    May 23, 2013 @ 16:04
    aghy
    0

    Yeh, not tested or developed for v6. I think they changed the way content has to be saved.

    Leave this open and I will eventually get round to fixing it.

    Thanks 
    Ben 

  • Bunnynut 128 posts 310 karma points
    May 23, 2013 @ 16:07
    Bunnynut
    0

    Thanks for replying so quickly.

    Can you give me a ballpark when this will be picked up? Because im woking on a project which really needs it.

  • aghy 129 posts 308 karma points
    May 23, 2013 @ 16:13
    aghy
    0

    Honestly I haven't touched v6 at all and I've not done any work on this data type for nearly a year. 

    I will have a look tonight and see what might be involved and get back to you.

    Since you're actively using it do you have any other feedback / features you think would make it better?

    Thanks

  • Bunnynut 128 posts 310 karma points
    May 23, 2013 @ 16:24
    Bunnynut
    0

    Thanks, that would be great!

    Well, now that you ask.
    Would it be possible to specify a parentnode when using the contentpicker type?
    That way i can make sure the user cannot make a wrong selection.

  • aghy 129 posts 308 karma points
    May 24, 2013 @ 11:07
    aghy
    0

    Hey, 

    So I had a look at the code last night, seems that it doesn't have a problem saving and it doesn't need any extra work to get it to use the ContentService new in v4.8 (I think). I think the problem is that something isn't happening in the same order as it used to or the new values are getting lost.

    I should be able to sort out a fix this weekend but I'm no longer working on v1, that code was way too messy, v2 is much more manageable but a lot less polished.

    Which version of MultiType are you using? 

    Ben

  • Bunnynut 128 posts 310 karma points
    May 24, 2013 @ 12:35
    Bunnynut
    0

    Hi Ben,

    Thank you for spending time ont this on such short notice.

    Im using 1.1.1.

  • aghy 129 posts 308 karma points
    May 30, 2013 @ 14:59
    aghy
    0

    Hey,

    Sorry it's been a while, I've been trying to work out what's going on with it all week! I've even had to crack open the umbraco source to work out what's changed. 

    I've found a change which seemed to actually save to the db when setting the value of the datatype. See line 132 on the left column. The code in red used to save to the db but it has been removed in v6 on the right.

    http://umbraco.codeplex.com/SourceControl/diff/file/view/9a0b8c00cd96?fileId=src%2Fumbraco.cms%2Fbusinesslogic%2Fdatatype%2FDefaultData.cs&olderChangeSetId=32b42601e80c 

    Since other datatypes are still working I must be looking in the wrong place but I can't work out how any change to the value is getting to the db.

    Ben

  • Bunnynut 128 posts 310 karma points
    May 31, 2013 @ 09:22
    Bunnynut
    0

    Hi Ben,

    Thank you for posting your findings and spending time on this.
    I have downloaded the source as well and im going to try to take a look at it as well.
    I will post my findings here.

    Thanks again!

  • Jeremy Pyne 106 posts 244 karma points MVP c-trib
    Jun 07, 2013 @ 21:29
    Jeremy Pyne
    0

    They changed it in v6 so that you have to exxpliscity call .Save() when updating content properties.  (This used to be automatic.)  I am guessing that is the problem. 

  • aghy 129 posts 308 karma points
    Jun 10, 2013 @ 11:41
    aghy
    0

    Hey Jeremy,

    Do you have any idea where I'm suppose to call Save? I've looked through the source for a few uComponents data types and can't see how their code has changed.

    Thanks

  • Jeremy Pyne 106 posts 244 karma points MVP c-trib
    Jun 10, 2013 @ 15:44
    Jeremy Pyne
    0

    Ok acctualy.  After fiddling a bit more I have noticed this difference:

    In the working version If you edit a property and add a new item and then add a second item the first item stays in place even if i dont click Save and publish.

    On the new broken setup if you add a item and then try to add a second item the first goes away.  

    So maby it is a problem with the vew state/post back process?  

  • aghy 129 posts 308 karma points
    Jun 10, 2013 @ 15:58
    aghy
    0

    Yep that's what I see.

    I put breakpoints on the MultiType DataEditors Save and OnInit methods I can see that I am trying to set _data.Value to the correct xml but then on the next OnInit call _data.Value has been reset. What baffles me is all the uComponents data types that I looked at for help the MultiType haven't changed and they still work in v6.

  • Jeremy Pyne 106 posts 244 karma points MVP c-trib
    Jun 10, 2013 @ 16:45
    Jeremy Pyne
    0

    Ok, maybe this is the difference.  In this controll the save event is raised at multiple points.  On a Add, update, delete witch updates the property value.  In other controlls I am seing the value is only updates/save called when the document is posted.  IE umbraco must not be saving changes to the data.value unless it was the source of the save call, so using the data.value as an interum storage while the data is filled in won't acuse the data to persist.  

     

    Maybe the controll can be serialize/restores on postbacks without going through data.value and then the .Save() just called by umbraco on its own on document save/publish.

    Technicaly in the current system you can add a few items, leave the page, come back and add more before publishing.  But this really isn't in line with the rest of Umbraco were if you leave the page you lose the changes.  Removeing the add/update/delete calls to save will remove this functionality but thats fine as its non-standard anyways.  

  • aghy 129 posts 308 karma points
    Jun 10, 2013 @ 17:21
    aghy
    0

    You're right, I shouldn't be calling Save on every change. I'll have to work out how to rebuild the control from the view state instead rebuilding from Data everytime. 

    Thanks for your help.

  • Jeremy Pyne 106 posts 244 karma points MVP c-trib
    Jun 10, 2013 @ 17:30
    Jeremy Pyne
    0

    Maybe its as simple as putting the xml results MultiTypeDataEditorControl.Save() into a hidden field on then on the MultiTypeDataEditor.OnLoad checking to see if the page is a postback or not, if so then use the value from that hidden field to fill data instead of data from the data.value.

  • mfeola 117 posts 221 karma points
    Sep 06, 2013 @ 17:57
    mfeola
    0

    Hi,

    Has there been any luck fixing this issue?

  • Jeremy Pyne 106 posts 244 karma points MVP c-trib
    Sep 06, 2013 @ 18:05
    Jeremy Pyne
    0

    We just switched to useing http://our.umbraco.org/projects/backoffice-extensions/embedded-content, Same features/type of plugin but it works in the new version. (It's aldo a javascript implementation so no more posting back to the server each time you make a change.)

Please Sign in or register to post replies

Write your reply to:

Draft