Copied to clipboard

Flag this post as spam?

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


  • Steve Bridges 51 posts 72 karma points
    Aug 20, 2012 @ 20:02
    Steve Bridges
    0

    Custom FieldType: settings is null during RenderPreview

    Hello - 

     

    I've added a setting here:

           [Umbraco.Forms.Core.Attributes.Setting("Lists to Display", description = "The selected lists to which the user can subscribe", control = "Liquid.Contour.Extensions.CampaignMonitorListsFieldSettingsType", assembly = "Liquid.Contour.Extensions")]
            public string ListsToInclude
            {get;set;}

     

    I can see the setting control - and choose my lists fine.  If i edit the field, the value is preserved fine.  All good.

     

    Problem is...the value is null when RenderPreview - so i can't use the setting at all to render the form value.

    I use the same pattern in workflowtype, recordactiontype, etc - and have no issues accessing this setting during "execute" - but in renderpreview of the fieldtype it is always null.

     

    Any help would be appreciated!  I'm sure i've missed something obvious as i'm new to this stuff, but i'm pulling my hair out here!

  • Comment author was deleted

    Aug 20, 2012 @ 20:10

    RenderPreview only affects the form builder, so it's the preview you get in the designer when adding and editing fields... so it might be that the settings aren't available in that method but since it's only used for the designer... you can simply return some sample markup

    Does it work ok when you test the actual form

    Regards,

    Tim

  • Steve Bridges 51 posts 72 karma points
    Aug 20, 2012 @ 20:22
    Steve Bridges
    0

    Thanks for the response Tim.

     

    No - it doesn't work on the actual form either.  However i do have to correct my original post as i left the form and came back to it (in designer) and found the issue is that the value is NOT getting saved at all.  I mistakenly said that the value was preserved.  (i had not moved off the page).

     

    I can set the value, but if i save the form and then return to it and edit the same field, the value is no longer set.

     

    As i mentioned the very same custom control DOES retain its value when used for workflytypes and record action types.

     

  • Steve Bridges 51 posts 72 karma points
    Aug 20, 2012 @ 22:35
    Steve Bridges
    0

    Further debugging shows that when i open the form to edit the field, i see the custom fieldsettingstype get instantiated.

    However, after i click on the "update" button in the designer, it does NOT hit my breakpoint in the set of the custom fieldsettingstype class.  (never sets the value).

    I goes right to the Renderpreview of the fieldtype.

    Any thoughts as to why when i submit the form, i'm not seeing it set the value in my custom fieldsettingstype?

     

    Again - when i run the same tests using the fieldsettingstype in workflow, i DO see the value get set (my breakpoint is hit).

  • Steve Bridges 51 posts 72 karma points
    Aug 21, 2012 @ 02:44
    Steve Bridges
    0

    Update:  I swapped out with some standard fieldsettingstypes and all is well.  My custom fieldsettings type works with all other provider types, so I'm chalking this up to a bug with custom fieldsettingtypes on custom fieldtypes.

    My workaround currently is using a custom prevalue source type (which utilizes my custom fieldsettings type to filter the sources).

    Then, on the form, i set the field to a STANDARD checkbox list and set it's prevalues to the custom prevalue list i just created.

    A bit more awkward than i was hoping (forces the user to visit the prevalues section seperately) but it will do until the custom fieldtypes/custom fieldsettingstype issue is resolved.

     

Please Sign in or register to post replies

Write your reply to:

Draft