Copied to clipboard

Flag this post as spam?

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


  • Steve 140 posts 321 karma points
    Oct 20, 2015 @ 20:11
    Steve
    0

    Umbraco Forms - scroll to form location on submit (or validation error)

    Hello, I have placed an Umbraco Forms contact form at the bottom of a page, below other content. When the form is submitted the page re-loads however the browser shows the top of the page, not the form which is/was at the bottom. (ie it's scrolled to the Top) It's not immediately clear to the user that they need to scroll down to the form again to see the 'Thank You...' message, or the validation summary in the event of an invalid entry. Does Forms have a way to handle scrolling to the location of the form after submitting or do I have to add DIY javascript to accomplish this? Thanks!

  • Steve 140 posts 321 karma points
    Oct 21, 2015 @ 17:43
    Steve
    0

    Hello again,
    I've learned why the form was posting back when the entries were invalid but still don't know how to get the page to scroll to the 'thank you' message.
    Anyone have an idea? I suppose an alternative would be to re-direct to a 'Thank You' page. It's definitely not good as it is now.
    Thanks, Steve

  • Chris Wilson 100 posts 377 karma points
    Oct 22, 2015 @ 09:00
    Chris Wilson
    0

    This approach seems to work as the forms are standard ASP.NET affair :)

    https://stackoverflow.com/questions/9392133/when-form-is-validated-how-to-scroll-to-the-first-error-instead-of-jumping

    /Chris

  • Steve 140 posts 321 karma points
    Oct 23, 2015 @ 17:52
    Steve
    0

    Chris,
    Yes, it seems like that approach would work. The client side validation (required references to the scripts noted in the link above) does prevent the post back and I ended up just pointing to a dedicated 'Thank You' page on successful submission. Was the easiest way to go.
    Thanks - Steve

  • Nicholas Westby 2054 posts 7100 karma points c-trib
    Oct 23, 2015 @ 18:57
    Nicholas Westby
    0

    An alternative solution would be to use AJAX forms; however, that isn't easy with Contour/Umbraco Forms.

  • Steve 140 posts 321 karma points
    Oct 24, 2015 @ 15:26
    Steve
    0

    Nicholas,
    Thanks. I'd like to do something like that but at this point not sure where to start. I'd also like to include an angularjs based cascading dropdown which is populated by a webapi (which we have built, but not yet integrated with Forms). However, I have no idea where to look for information on how to accomplish this. Just checked the umbraco documentation on creating forms based on datasources - got the "ooops, something broke message"... I really wish the Forms documentation was more thorough/reliable!
    /Steve

Please Sign in or register to post replies

Write your reply to:

Draft