Copied to clipboard

Flag this post as spam?

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


  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 03, 2016 @ 11:59
    Tim
    0

    Schroedingers Forms In Contour

    Right, we have a site that is running Umbraco 7.4.1 and Contour 3.0.28, it's hosted on Azure as a WebApp. There is a dedicated back office instance and a front end instance. Fastly (basically posh Varnish) sits in front of the site and caches certain key pages (not the forms though).

    Just recently, we're having an issue where you fill in the form, including all the required fields, and the page just reloads, with no error messages. No fields are tagged as invalid, and if we tell the form to show the validation errors, nothing is shown. The form fields have all got the correct data in though, so the model binding etc is all working just fine.

    No errors are being logged by Contour, or in the Umbraco logs, and the site wide error logging we're using shows nothing either.

    Now here's where it gets REALLY odd. Even though for me, I can't submit the forms, other users appear to be able to, as there are fresh entries appearing in the back end entries list. The site has effectively got Schroedingers forms, both broken and working at the same time. Various other users and the client have the same issues, so it's not just me/our network where the issue occurs.

    The only thing I can think of is maybe something to do with the validation tokens not being validated properly maybe? Apparently Azure ensures that the instances all have the same machinery, but maybe that's not happening? It's a tricky one to debug. The issue doesn't occur on locally,or on staging, it just seems to happen on the live environment, so I assume it must be something to do with the setup. But we have other sites running Contour fine on a similar setup.

    If anyone has any ideas or has come across this before, your help/advice would be massively appreciated!

  • Comment author was deleted

    Nov 03, 2016 @ 12:19

    Any chance you have nested forms? So it might be that the Contour form is submitting a parent form...

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 03, 2016 @ 13:17
    Tim
    0

    Nope, it's MVC views, so all forms self contained.

  • Tom Pipe 14 posts 100 karma points c-trib
    Nov 04, 2016 @ 01:25
    Tom Pipe
    0

    This sounds familiar. I had something where another form had the same id/name on the page. Submitting one, actually submitted the other, but caused a similar issue where nothing appeared to happen. Unlikely being contour, unless you've modified markup, or maybe have the same form twice in two areas of the page perhaps?

    What does fiddler show? Does it highlight anything out if the norm?

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Nov 07, 2016 @ 08:01
    Warren Buckley
    0

    Hi Tim,
    I would suggest based on Tom's reply. What does network traffic in the browser dev tools or something like Fiddler show?

    Also has any JavaScript been added/removed/modified recently that may be interfering with form submissions perhaps?

    Does anything in UmbracoLog file show any errors at all (along with any 500 or similar network requests)?

    Thanks,
    Warren

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 07, 2016 @ 10:00
    Tim
    0

    From our further investigations, the only other form on the page is the search form, which if it was submitted would take you to the search results, so it's definitely not that.

    No extra scripts that should interfere, and it's working for some users, so not that either.

    Fiddler shows nothing untoward, as does chrome inspector etc, form submits, returns 200, page reloads, but instead of thank you message, you get the form with all the values pre-filled.

    We thought maybe there was a hidden field that was mandatory not being set, but adding a validation summary shows no invalid fields, so it's not that either.

    Nothing in any of the logs relating to this that we can see.

    Currently wondering if it's an issue with the AntiForgery tokens not being validated correctly thanks to the Azure load balancing? It's not throwing an error though, but we're trying to see if the Azure affinity stuff is working properly, or if it's submitting to a different server, which might cause the AF validation to fail (although Azure is meant to take care of that for you). Will let you know how we get on with that investigation.

  • Tom Pipe 14 posts 100 karma points c-trib
    Nov 07, 2016 @ 10:03
    Tom Pipe
    0

    Try tamper with the anti forgery tokens and/or honeypot fields to try force an error. If it errors, you can eliminate that line of inquiry.

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 07, 2016 @ 10:15
    Tim
    0

    Just tried tweaking the value of the AF token hidden field, and that's not thrown any kind of error, same behaviour, just reloads the fame with the populated form, and the contour submit still hasn't fired, as there's nothing in the database. Bit of a head scratcher this one.

  • Tom Pipe 14 posts 100 karma points c-trib
    Nov 07, 2016 @ 10:40
    Tom Pipe
    0

    Perhaps try hooking into the FormValidate event so you can verify:

    • Submit is actually hitting the UmbracoFormsController.HandleForm method
    • There are no validation errors

    Good luck ;)

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 07, 2016 @ 10:59
    Tim
    0

    Any ideas where the FormValidate event is for me to hook into it?

  • Tom Pipe 14 posts 100 karma points c-trib
    Nov 07, 2016 @ 11:01
    Tom Pipe
    1
    UmbracoFormsController.FormValidate += (sender, args) =>
        {
            if (args.Form.Id == new Guid(YourFormGuid))
    
  • Tom Pipe 14 posts 100 karma points c-trib
    Nov 07, 2016 @ 11:03
    Tom Pipe
    1

    To check modelstate for errors you'll need this

    ((UmbracoFormsController) sender).ModelState.
    
  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 07, 2016 @ 11:06
    Tim
    0

    Got it, ta! Will have a good old dig around and see what's happening.

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Nov 08, 2016 @ 09:27
    Warren Buckley
    0

    Thanks Tom, for being so helpful to give Tim some pointers (currently ill with a cold)

    Be interesting to hear your findings if these events are hit or not when you debug the site Tim.

    Thanks,
    Warren

  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 16, 2016 @ 17:48
    Tim
    100

    We finally got to the bottom of this. The client had something in the Varnish config that was helpfully stripping out the cookies, including the Azure affinity one, which was never spotted when they were just on one instance, as it always went back to the same one, but now they've scaled up, the cookie isn't there, so you don't always go back to the server that rendered the form, which breaks the submissions.

    Now the cookies aren't getting stripped, everything works as expected.

    :)

    Thanks for you help everybody!

  • Warren Buckley 2106 posts 4836 karma points MVP 7x admin c-trib
    Nov 17, 2016 @ 10:31
    Warren Buckley
    0

    Thanks for the update Tim & glad to hear you found the problem.

Please Sign in or register to post replies

Write your reply to:

Draft