Copied to clipboard

Flag this post as spam?

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


  • Greg Fyans 140 posts 342 karma points
    Jan 17, 2014 @ 17:25
    Greg Fyans
    0

    Code first form fields disappear/reappear on app restart

    Hi,

    I have a strange issue with code first forms that only occurs when the application restarts.

    If the form doesn't exist, then it is created just fine, but when the app restarts for any reason (app pool recycle, web.config change, new assembly etc.) all of the form fields disappear from the front and back end. The form is still there, but none of the fields are. Another restart brings them back.

    Anyone encountered this before?

    Greg.

  • Comment author was deleted

    Feb 17, 2014 @ 17:11

    Not seen this one before, will try to repro, 

  • Comment author was deleted

    Feb 17, 2014 @ 17:11

    Is this on umbraco v4/V6/V7 ?

  • Greg Fyans 140 posts 342 karma points
    Feb 17, 2014 @ 18:56
    Greg Fyans
    0

    Hi Tim,

    Umbraco: 6.1.6
    Contour: 3.0.19

    Here's a screencast from a brand new installation of Umbraco/Contour: http://screencast.com/t/zHm3K5vzv86u

    It's a really basic codefirst form, just the 2 fields. In my other project I have a custom form field which I first suspected was the culprit, but this confirms it's not that.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Umbraco.Forms.Core;
    using Umbraco.Forms.CodeFirst;
    using Umbraco.Forms.Core.Providers.FieldTypes;
    using Umbraco.Forms.Data.Storage;
    using System.Configuration;
    
    namespace WebApplication1.Definitions
    {
        [Form("LoginForm", ShowValidationSummary = false,
            DisableDefaultStylesheet = true,
            StoreRecordsLocally = false)]
        public class LoginForm : FormBase
        {
            [Field("Log in", "", Caption = "Email Address",
                Mandatory = true,
                Regex = @"(\w[-._\w]*\w@\w[-._\w]*\w\.\w{2,3})")]
            public string Username { get; set; }
    
            [Field("Log in", "",
                Type = typeof(Password),
                Mandatory = true)]
            public string Password { get; set; }
    
            public override IEnumerable<Exception> Validate()
            {
                var e = new List<Exception>();
    
                return e;
            }
    
            public override void Submit()
            {
                System.Web.HttpContext.Current.Response.Redirect(umbraco.library.NiceUrl(1047) + "?done=true");
            }
        }
    }
    
    Greg.
  • Comment author was deleted

    Feb 17, 2014 @ 19:48

    Thanks for the details will try to repro this week, more info soon

  • Poul Hansen 5 posts 25 karma points
    May 04, 2014 @ 12:22
    Poul Hansen
    0

    We're experiencing the same thing using Umbraco 4.11.8 and Contour 3.0.12, we didn't notice this issue, but were made aware of it a week ago, as with Greg, an App Restart will actually make this work for an unspecified amount of time, after which the content disappears.

    Is there any news about this Tim?

    using System;
    using System.Collections.Generic;
    using Umbraco.Forms.CodeFirst;
    using Umbraco.Forms.Core.Providers.FieldTypes;
    using Website.Libraries.Antenneforening;
    using umbraco.cms.businesslogic.member;
    
    namespace Website.Libraries.Contour
    {
        /// <summary>
        /// Custom contour flow for login
        /// </summary>
        [Form("Onlineservice/Login", ShowValidationSummary = true, MessageOnSubmit = "Du er nu logget ind")]
        public class Login : FormBase
        {
            /// <summary>
            /// Union login name field
            /// </summary>
            [Field("Login", "", Caption = "Vælg forening", Type = typeof(DropDownList), Mandatory = true, PrevalueSource = "Onlineservice Login" )]
            public string Forening { get; set; }
    
            /// <summary>
            /// Union login password field
            /// </summary>
            [Field("Login", "", Caption = "Tast-Selv-Kode", Type = typeof(Password), Mandatory = true)]
            public string Password { get; set; }
    
            /// <summary>
            /// Try to login given the union/password, otherwise return what went wrong
            /// </summary>
            /// <returns>A list of exceptions, 0 elements if success</returns>
            public override IEnumerable<Exception> Validate()
            {
                var e = new List<Exception>();
    
                try
                {
                    Method.Login(Forening, Password);
                }
                catch (Exception ex)
                {
                    Password = "";
                    e.Add(ex);
                }
    
                return e;
            }
    
            /// <summary>
            /// Login a user and add the memeber login data to cache
            /// </summary>
            public override void Submit()
            {
                Method.Login(Forening, Password);
    
                var m = Member.GetMemberFromLoginNameAndPassword(Forening, Password);
    
                if (m != null)
                    Member.AddMemberToCache(m);
            }
        }
    }
    
  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 07, 2014 @ 17:50
    Martin Griffiths
    0

    Hi Tim

    Any news on this issue?

    I've noticed fields missing on some of my codefirst forms when I upgraded a project from u4.11 to u7.1.1.

    Need a resolution to this fairly pronto.

    Kind regards

    Martin

     

     

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 11:07
    Martin Griffiths
    0

    Hi Tim

    I've noticed when codefirst forms are pulled into umbraco 7 for the first time you have to remove the two entries in the web.config otherwise i get a YSOD. They get put back in once the app has restarted. I'm not sure if this is related?

    My install has quite a few code first forms and it seems pretty random which ones are missing fields, I cannot see anything obvious. Is it possible (at least in the case of u7) it could be some kind of agressive caching problem?

    You've come through in the past for me when I needed prompt attention to the contour codebase...dont let me down ;-)

    Thanks 

    Martin

  • Comment author was deleted

    May 08, 2014 @ 11:20

    Looking into the issue know will keep you updated 

  • Comment author was deleted

    May 08, 2014 @ 11:21

    Only syncing when in debug mode and not trying to sync otherwise would that be an option? 

  • Comment author was deleted

    May 08, 2014 @ 11:22

    And you are sure a content editor hasn't changed the forms?

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 11:23
    Martin Griffiths
    0

    Hi Tim

    I testing local only at the moment so yes in debug mode.

    M.

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 11:40
    Martin Griffiths
    0

    Hi Tim

    I've tried running up my local instance with debugging enabled and disabled and it doesnt make any difference. Lots of forms with holes either way.

    M.

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 12:02
    Martin Griffiths
    0

    Hi Tim

    I've just taken a look at the UFFields table and it's missing rows. So the import process on application start isnt working correctly.

    M.

  • Comment author was deleted

    May 08, 2014 @ 12:03

    Ok I can reproduce the issue, looking into a fix now, hope to have it ready today!

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 12:04
    Martin Griffiths
    0

    Phew cheers Tim.

    M.

  • Comment author was deleted

    May 08, 2014 @ 12:09

    Ok and think I see what is happening for some reason it is removing the fields even though they don't need to be removed so fixing it now, bug fix will be available today

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 12:11
    Martin Griffiths
    0

    Thanks Tim you rock!

  • Comment author was deleted

    May 08, 2014 @ 12:15

    Of found it was a stupid type, build server is running now

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 12:15
    Martin Griffiths
    0

    One last thing Tim, what's the significance of the two ContourFormBuilderHttpModule web.config entries needing to be missing on first start? Is there any other way this can be achieved? It seems a bit scrappy that I have to remember to remove them on first import.

    M.

  • Comment author was deleted

    May 08, 2014 @ 12:16

    @Martin could you create new forum topic for that :)

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 12:17
    Martin Griffiths
    0

    Sure :)

  • Comment author was deleted

    May 08, 2014 @ 12:18

    @Martin thanks, that way it's easier to keep track :)

    For the missing fields could you give http://nightly.umbraco.org/Umbraco%20Contour/3.0.21/ a try

    And let me know if that fixes it (should also fix a YSOD you can get when first importing the form)

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 12:27
    Martin Griffiths
    0

    AWESOME! fields back to normal no YSOD!

    I was hoping to attend CG14 but family pressures mean i've had to dip out another year! :-(

    When I finally get the chance to attend CodeGarden, I owe you quite a few beers!

    All the best

    Martin

     

  • Comment author was deleted

    May 08, 2014 @ 12:29

    Great thanks for confirming :) There is also the Uk festival ;) should be in october/november!

  • Greg Fyans 140 posts 342 karma points
    May 08, 2014 @ 12:30
    Greg Fyans
    0

    Thanks, Tim, I'll give it a whirl and let you know how it goes.

     

    Greg.

  • Martin Griffiths 826 posts 1269 karma points c-trib
    May 08, 2014 @ 12:30
    Martin Griffiths
    0

    I'll look out for it. :-)

    M.

Please Sign in or register to post replies

Write your reply to:

Draft