Copied to clipboard

Flag this post as spam?

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


  • Simon Hewitt 65 posts 126 karma points
    Mar 10, 2013 @ 14:07
    Simon Hewitt
    0

    Content picker used in field type

    Hi all,

    Im trying to implement a method that allows my user to add html snippets into forms as explanatory text sections. I have created a custom field type that correctly displays the content picker when setting the field up but if I try to edit the field the javascript fails and nothing happens when I click to edit.

    I'm assuming there is something wrong with my editor setup but I can't find an example of what editor I should be using so I'm not sure what to do next.

    Heres the error being thrown;

    Uncaught TypeError: Cannot read property '_itemIdValueClientID' of undefined 

    Which is thrown from the SetPickerValue method in umbracoforms.js. It fails because it can't find the element with the ID thats being passed into the function (pickerClientId).

    Here is my editor constructor;

    private ContentPickerWithXpathOption cc = new ContentPickerWithXpathOption();
             
    public override System.Web.UI.WebControls.WebControl Editor
    {
    get
            {
            cc.ShowXPath = false;
                    cc.ID = "cc_" + this.Id;
                    if (!String.IsNullOrEmpty(NodeToShow)) cc.Value = NodeToShow;
                    return cc;
             }
             set
             {
                    base.Editor = value;
             }
    }

    Any help or direction appreciated.

    Simon

  • Comment author was deleted

    Mar 11, 2013 @ 09:25

    So the contextpicker is an setting on your custom fieldtype, don't think that it fully supported at the moment, will take a look

  • Simon Hewitt 65 posts 126 karma points
    Mar 15, 2013 @ 12:12
    Simon Hewitt
    0

    Hi Tim,

    Thanks for looking into this for me. Yes the content picker is a setting on the custom fieldtype, everything works except the edit field option.

    I was just guessing at the editor setup above and was wondering if I should be using the content picker from the Umbraco.Forms.Core.FieldSetting.Pickers namespace for the editor. The issue I'm having there is trying to get it output as some kind of WebControl as I cant embed that picker in a panel or return it directly in the getter.

    Any advice would be great.

    Thanks

    Simon

  • Comment author was deleted

    Mar 18, 2013 @ 08:53

    Looking into this today so more details will folow shortly

  • Comment author was deleted

    Mar 18, 2013 @ 16:13

    Thought it was a bug but it is just not supported atm so will need some work to support the content picker, will do the updates this week

  • Kees de Wit 11 posts 31 karma points
    Apr 11, 2013 @ 18:28
    Kees de Wit
    0

    Hello Tim,

    We are using version 3.0.9 and we have the same issue. Everything works great, except for the edit button that causes the javascript exception. Could you please look in to this? Thanks in advance.

    With kind regards,

    Kees de Wit

  • Kees de Wit 11 posts 31 karma points
    Apr 12, 2013 @ 16:14
    Kees de Wit
    0

    Here is the bug report for this issue: http://issues.umbraco.org/issue/CON-328

  • Comment author was deleted

    Apr 15, 2013 @ 10:15

    Ok assigned it to the next maintenance release so a fix should be part of the 3.0.10 release

  • Kees de Wit 11 posts 31 karma points
    Apr 15, 2013 @ 17:43
    Kees de Wit
    0

    Many thanks! When do you plan to release the 3.0.10?

  • Comment author was deleted

    Apr 15, 2013 @ 17:44

    1 May or sooner

  • Kees de Wit 11 posts 31 karma points
    Apr 16, 2013 @ 09:10
    Kees de Wit
    0

    Is there any way (maybe if we pay some money) to get this fixed earlier?

  • Comment author was deleted

    Apr 16, 2013 @ 12:40

    Soonest I can look is Monday so more news will follow then, hope it's an easy fix 

  • Kees de Wit 11 posts 31 karma points
    Apr 17, 2013 @ 16:02
    Kees de Wit
    0

    Monday would be great. We just bought the license. Let's hope it's a minor fix.

  • Comment author was deleted

    Apr 17, 2013 @ 16:48

    Yup will keep you posted on the progress

  • Comment author was deleted

    Apr 22, 2013 @ 09:44

    Hmm just tested and don't get the bug, could you tell me what Umbraco version you are running

     

  • Kees de Wit 11 posts 31 karma points
    Apr 22, 2013 @ 09:48
    Kees de Wit
    0

    We are using Umbraco v6.0.3 (Assembly version: 1.0.4836.20227) with contour 3.0.9

  • Kees de Wit 11 posts 31 karma points
    Apr 22, 2013 @ 09:59
    Kees de Wit
    0

    Steps to reproduce:

    • Add new form to contour
    • Add field with content picker setting
    • Choose content for picker
    • Click add field button
    • Click edit icon
    • Javascipt error

    I can also send the source code of the field that contains the content picker setting or any other sourcecode if that will help.

  • Comment author was deleted

    Apr 22, 2013 @ 10:04

    Ok thanks will try with that version

  • Comment author was deleted

    Apr 22, 2013 @ 10:26

    Ok can reproduce the bug if I'm using Umbraco 6.0.3

  • Simon Hewitt 65 posts 126 karma points
    Apr 22, 2013 @ 10:39
    Simon Hewitt
    0

    Hi Tim,

    Just to muddy the waters we are using Umbraco 4.11.4 and Contour 3.0.9 but its the same steps as Kees to reproduce the issue and I can also provice source for the fieldtype if that will help.

  • Comment author was deleted

    Apr 22, 2013 @ 11:12

    Ok thanks for the extra details, looking into a fix now

  • Comment author was deleted

    Apr 22, 2013 @ 13:24

    Ok looks like it's due to some changes made in the core Umbraco content picker, fix eta today/tomorrow

  • Comment author was deleted

    Apr 23, 2013 @ 16:32

    Almost there, just need to do some additional tests but you can expect a fix later today

  • Kees de Wit 11 posts 31 karma points
    Apr 23, 2013 @ 16:32
    Kees de Wit
    0

    Great news! I've been waiting for this all day ;)

  • Comment author was deleted

    Apr 23, 2013 @ 17:32

    Ok looks good could you try your custom fieldtype with a 3.0.10 install

    nightly.umbraco.org/.../

    If that works you can upgrade 

    our.umbraco.org/.../Upgrade

  • Simon Hewitt 65 posts 126 karma points
    Apr 24, 2013 @ 13:28
    Simon Hewitt
    0

    Hi Tim,

    I updated a clone of my production site and I now when I add my custom fieldtype I get a javascript error and the field fails to show the content picker in additional settings. On previously created fields I get the same error when trying to edit.

    Here are some details from an inital look

    [input#body_ctl01_rptFieldTypeSettings_rptFieldTypeSpecificSettings_3_ctl00_0_ContentIdValue_0prevObjecte.fn.e.init[1]contextdiv.formControl leftPad10selector"input"constructorfunctioninitfunction]
    1. 0input#body_ctl01_rptFieldTypeSettings_rptFieldTypeSpecificSettings_3_ctl00_0_ContentIdValue_0
    2. contextdiv.formControl leftPad10
    3. length1
    4. prevObjecte.fn.e.init[1]
    5. selector"input"
    6. __proto__Object[0]
    umbracoforms.js:1651
    pickerClientId: body_ctl01_rptFieldTypeSettings_rptFieldTypeSpecificSettings_3_ctl00_0_0 umbracoforms.js:1731
    1. Uncaught TypeError: Cannot call method 'ClearSelection' of undefined

    Its falling over when it hits the ClearPickerValue function with the error above. In the snippet above I'm dumping out the selected node and then the picker id after you have finished stripping out certain strings just before it trys;

    Umbraco.Controls.TreePicker.inst[pickerClientId].ClearSelection();

    I've checked and double checked my deployment of the wip patch and can't see anything I've missed.

    Hope that helps a little.

    Simon

     

  • Comment author was deleted

    Apr 24, 2013 @ 13:46

    Thanks for the details Simon, will test on the umbraco version you are running, 4.11.4 right?

     

  • Simon Hewitt 65 posts 126 karma points
    Apr 24, 2013 @ 13:47
    Simon Hewitt
    0

    Yup,

    Thanks for the fast reply :)

  • Comment author was deleted

    Apr 24, 2013 @ 14:47

    @Kees any chance you can also try to see if your issue has been resolved on umbraco 6 

  • Kees de Wit 11 posts 31 karma points
    Apr 24, 2013 @ 14:49
    Kees de Wit
    0

    I'm temporarily on another project with priority so I can test this tomorrow morning. First thing tommorow.

  • Comment author was deleted

    Apr 24, 2013 @ 14:52

    @Kees ok thanks, but I'm pretty sure the content picker is working it's the content picker with xpath that is still giving issues

     

  • Comment author was deleted

    Apr 24, 2013 @ 14:58

    @Simon just tested and contentpickerwithxpath is also working in my setup 

    Any chance you can share the code of your custom fieldtype?

  • Simon Hewitt 65 posts 126 karma points
    Apr 24, 2013 @ 16:01
    Simon Hewitt
    0

    Sure,

    Its a bit of a mash up of bits I've found in the forum and in examples on contour.contrib so as I think I said right at the beginning of this thread I have no idea if I am calling the right picker types in here.

    The relevent bits are

    [Setting("Html To Show", prevalues = "",
               description = "HTML content to be displayed",
               control = "Umbraco.Forms.Core.FieldSetting.Pickers.Content")] 
            public string NodeToShow { get; set; }

    and the editor is

    private ContentPickerWithXpathOption cc = new ContentPickerWithXpathOption();
     
            /// 
            /// Gets or sets Editor
            /// 
            /// 
            public override System.Web.UI.WebControls.WebControl Editor
            {
                get
                {
                    cc.ShowXPath = false;
                    cc.ID = "cc_" + this.Id;
     
                    if (!String.IsNullOrEmpty(NodeToShow)) cc.Value = NodeToShow;
                    return cc;
                }
                set
                {
                    base.Editor = value;
                }
            }

     

    I have emailed you the entire class file to your umbraco.dk address.

     

  • Comment author was deleted

    Apr 24, 2013 @ 16:40

    Ok found and fixed the issue, new build is up, so upgrade to the latest 3.0.10 WIP http://nightly.umbraco.org/Umbraco%20Contour/3.0.10%20WIP/ make sure to clear browser cache since it involves a couple of js updates

  • Simon Hewitt 65 posts 126 karma points
    Apr 24, 2013 @ 17:04
    Simon Hewitt
    0

    That one worked a treat, you just made quite a few people here very happy.

    Thanks for all your time on this one :)

    Simon

     

  • Comment author was deleted

    Apr 24, 2013 @ 17:09

    Sweet, thanks for confirming!

  • Kees de Wit 11 posts 31 karma points
    Apr 25, 2013 @ 10:25
    Kees de Wit
    0

    I'm also glad to confirm that this fix works. Thank you very very much!

  • Comment author was deleted

    Apr 25, 2013 @ 11:41

    Great, thanks for confirming :)

  • Sergey 1 post 21 karma points
    Dec 12, 2013 @ 09:39
    Sergey
    0

    Hi guys!

    It looks like that I have a related issue with 3.0.18.

    I've set up Umbraco 7 release and Contour 3.0.18 from http://nightly.umbraco.org/Umbraco%20Contour/3.0.18/.

    Everything works well until I started to use Umbraco.Forms.Core.FieldSetting.Pickers.Content as control for my porperty from Additional settings, here is code:

    [Setting("ParentNode", control = "Umbraco.Forms.Core.FieldSetting.Pickers.Content", description = "Enter the parent node for prevalues")]
    public string ParentNode { get; set; }

    For example if I use Umbraco.Forms.Core.FieldSetting.Pickers.DocumentType it works well.

    The console throws exception of umbracoforms.js: 

    Uncaught TypeError: Cannot read property 'inst' of undefined


     Am I doing something wrong?

    Any help will be appreciated. Thanks in advance

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Sep 26, 2014 @ 06:15
    Peter Gregory
    0

    I just hit this issue with Contour v3.0.21 on Umbraco 7.1.5

    This happens when one of my Settings for a custom type is set to Umbraco.Forms.Core.FieldSettings.Pickers.Content.

    Uncaught TypeError: Cannot read property 'inst' of undefined

    Simple types are fine.

    Any help on this one Tim would be ace.

  • Brian McBride 3 posts 23 karma points
    Dec 03, 2014 @ 18:05
    Brian McBride
    0

    I am having the same issue as Peter

Please Sign in or register to post replies

Write your reply to:

Draft