Client-side validation is resetting scroll position

Discussion in 'ASP .Net' started by jasondavidcarr@gmail.com, Nov 24, 2006.

  1. Guest

    Hello all,

    I have a "comments" page that contains three sections; the article to
    be commented on is on top, followed by previous comments, and on the
    bottom a place to add new comments. It's a pretty common scenario.

    I have two links from the main article page; one to view the comments
    and one to add a new comment. I'm simply using <span id="top"> and
    <span id="bottom">, and #top or #bottom in the query string to
    distinguish between the two. This works beautifully.

    However, the issue comes with the client-side validation. I'm using
    ASP.NET 2.0's built-in validation controls. For some reason, the
    javascript that validates the controls when I hit my submit button is
    automatically scrolling the page back to the top, which is unacceptable
    because the user has to scroll back down to the bottom every time there
    is an error with their entry. The page is not posting back at this
    point; I've read numerous articles on how to maintain scroll position
    across postbacks, but this is client-side validation.

    On a further note, my site works properly without javascript enabled as
    well. ASP.NET's validation controls handle this properly and simply
    post back to the server to do all validation. In this scenario, I'd
    like to know of a way to scroll back down to the bottom of the page if
    errors occurred in the validation, or stay at the top if they did not.

    Any ideas/suggestions/solutions would be greatly appreciated, and I'm
    willing send $5 via PayPal to whoever can solve my problem. Not that
    $5 is a lot of money :).

    Thanks for your help in advance!

    Jason
    , Nov 24, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Matt
    Replies:
    14
    Views:
    4,096
    Chad Z. Hower aka Kudzu
    Jan 30, 2004
  2. =?Utf-8?B?dmlkeWE=?=
    Replies:
    1
    Views:
    748
    Kevin Spencer
    Jun 2, 2005
  3. Chris Rathman
    Replies:
    0
    Views:
    670
    Chris Rathman
    May 15, 2006
  4. Boss302
    Replies:
    0
    Views:
    1,038
    Boss302
    Nov 21, 2006
  5. Bogdan
    Replies:
    2
    Views:
    649
    Bogdan
    Jun 9, 2008
Loading...

Share This Page