7956 Posts in 1394 Topics by 945 members
|Go to End|
3 December 2010 at 4:50pm
Hi all, apologies if this has already been solved elsewhere, however UC's SVN repo seems to have disappeared behind authentication at this forum sucks for searching.
I have an issue with HasManyFileDataObjectManager. If you use it to create a new related File object it will create it correctly however within the DOM the checkbox is not ticked. Consequently, if you then save the parent object without refreshing the page it will delete the relation.
Anyone have any ideas how to get around that? It should populate the table ticked, but I can't for the life of me see where that is happening to fix it.
3 December 2010 at 5:37pm
The SVN is behind authentication? I can't imagine why. I haven't touched the settings in over a year. It says anonymous reads are still on, and in my testing, I'm not getting an authentication wall. That's bizarre.
The problem you're describing could very well be a bug. HasManyDOM is so rarely used. I don't think I've tested it in a long time. I've never come across a situation where HasManyDOM was more practical than ManyManyDOM.
So before I do any digging, you're sure that HasManyDOM is what you want? Usually $has_many relations are served better by a regular DOM.
6 December 2010 at 7:19pm
Well I've always been prompted for a password when using the browser viewer, but that never stopped me looking at it or checking out until recently. Still a problem.
Will try a ManyManyDOM - yes I'd prefer HasMany, but ManyMany will do.
14 December 2010 at 4:31pm Last edited: 14 December 2010 4:33pm
Hey UC, have access now (still asking for a login using Chrome - no idea why though). I've switched to latest trunk Uploadify + DOM and ManyManyFileDataObjectManager. Now uploading the file works, however the new DataObject created is not related to the parent object.
1. I select Add DataObject
2. Upload file
3. Fill in popup CMS forms for that DataObject
4. Press Save
5. Object appears in the database, but is not related to the parent object
15 December 2010 at 4:03am
With MMDOM, you have to check the box after adding. There are some snippets out there that will force the check on add.
Try this on your DataObject:
public function onAfterWrite()
// new record?
DB::query("INSERT INTO `YOUR_JOIN_TABLE` SET [YourParentPage]ID = ". $_POST['ctf']['sourceID'] . ", [YourChildObject]ID = $this->ID");
16 December 2010 at 12:07pm Last edited: 16 December 2010 1:18pm
Thanks, I used a variation to get a partial solution - however I am now back to the original problem: The new record appears in the table un-ticked. Consequently, if I now save the record (without explicitly ticking the box) it is removed from the relationship again.
EDIT: Ok, I think the problem is that the select values hidden field needs to be updated, eg it will look like this:
<input id="Form_EditForm_ProjectFiles_CheckedList" name="ProjectFiles[selected]" type="hidden" value=",10678,10682,10977,10681,10680,10679,10710,10688,10697,10707,10687,10696,10706,10686,10695,10705,10685,10694,10704,10684,10693,10703,10692,10702,10691,10701,10690,10700,10709,10689,10698,10708,">
So when the .refresh is called it doesn't check the box. Will post a solution when I find it
EDIT2: Ok, for others who want this enabled, you need to modify FileDataObjectManager.php, the closePopup() method. Add the following line to the customScript:
This blanks the checked values list and it will default to all checked.
|Go to Top|