Item selection problem

Topics: Developer Forum
Jun 9, 2008 at 4:55 PM

 I have created a content item that contains the property RedirectUrl as shown here:

[N2.Details.Editable("Redirect to", typeof(N2.Web.UI.WebControls.UrlSelector), "Url", 50, ContainerName = Hojgaard.Tabs.Content, Required = true)]
public virtual string RedirectUrl
{
    get { return (string)this.GetDetail("RedirectUrl"); }
    set { this.SetDetail("RedirectUrl", value); }
}

The property is shown correctly when editing in the backend. When I open the item selector, and select an item, the item url is correctly added to the RedirectUrl property. But immediately thereafter, N2 redirects to the selected page and the url is not saved.

What can I do to make N2 not show the selected page?

In the N2 example site (http://templates.n2cms.com/) the item selector opens the selected page in a new browser.
This would be an okay solution… but how to do that?

Coordinator
Jun 9, 2008 at 6:44 PM
This sounds like a javascript error. At least I remember fixing something of this sort some time ago. What version are you using? Does it make any difference if you remove cached javascript files?

The selector creates an unordered list with plain links. Uplon loading the page on the client a javascript pass through them and attach an event that replace the normal behaviour (opening the linked page). From your description it sounds like the click isn't taken care of correctly.
Jun 9, 2008 at 7:05 PM

I’m using N2 version 1.3.5 and Microsoft Explorer version 7.0.

I tried to delete all cached files from the browser and tried out the item selector again.
Unfortunately that did not solve my problem – N2 still redirects to the selected item.

In Firefox the item selector works as expected – it retrieves the item url and closes the dialog.

Coordinator
Jun 9, 2008 at 8:17 PM
I think I might have found it. Does the problem occur on pages that are already expanded when you open the dialog?
Jun 10, 2008 at 6:23 AM

Yes, you are absolutely right :)
It seems the problem is only when I select an expanded item.

Coordinator
Jun 10, 2008 at 4:24 PM
Thanks, good find. I've committed a fix.
Jun 10, 2008 at 7:00 PM
Is it possible to download the fix before the next release?
Coordinator
Jun 10, 2008 at 11:07 PM
Sure, you can get the source code. Anyhow I'll probably do a release soon.