Question

I have a Custom URL That loads all the fields from a multi value text field for modifying.

When the save button is clicked it should update all the fields but at the moment all it does is add additional parameters rather than update the exisitng ones, how would I delete all the existing values ready to repopulate.

my save function looks like this

function SaveAndClose()
{
    var returnValues = new Array();

    var selectobject=document.getElementById("FeedItem")
    for (var i=0; i<selectobject.length; i++)
    {
        if (selectobject.options[i].value != '')
        {
            returnValues.push(selectobject.options[i].text);
        }
    }
    window.returnValue = returnValues;
    self.close();
}
Was it helpful?

Solution 2

This is possible with the newer API introduced in SDL Tridion 2011, but I don't think you can do it in 2009.

From the SDL Tridion 2009 SP1 Content Management Implementation Manual

(Section 9.15.3, Using a Custom URL to fill in the value of a field)

Multivalued fields — Should use an array for the returnValue. Each entry in the array represents a value to insert in the field.

OTHER TIPS

IIRC :) the return value of a Custom URL popup window for a multi-value field is an array of Strings.

Therefore, simply return an empty array and that should in fact remove all values of the field.

EDIT:

The approach I took on this a while back was to mess with the DOM structure of the Tridion Component window. Therefore, in my popup code, I would take a handle to the 'parent' window and using JavaScript (jQuery would do it nicely) identify the field you want and remove all its 'multi-value' child nodes. Then simply return the array in your JS window.returnValue and that should populate it back with the values you want.

Unfortunately I can't find the code I wrote a few years ago... so you are on your own...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top