Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 12 of 12
  1. #1
    New Coder
    Join Date
    Jul 2002
    Location
    San Francisco
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy radio button makes page jump to top

    This form has radio buttons half way down the page. When one of the radio buttons is selected, the page jumps back up to the top. Is it re-loading? How do I stop it?

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *scratches head*

    Which form?

  • #3
    New Coder
    Join Date
    Jul 2002
    Location
    San Francisco
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Like, I am from California and say "like, this" too much... causing listeners to return puzzled looks and thoughts of blonde jokes.

    ...

    When selected, this form's radio-button calls a function which refreshes the page.

    function onChange()
    {
    document.Define.COMMAND.value="RefreshPage";
    document.Define.submit();
    }


    However, the radio button is at the bottom of the page. And onChange, jumps the page back to the top. Very clumsy.

    I could direct it to jump back down, but would prefer a more seamless appearance when it refreshes.

    Like, any help appreciated, dude.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I wasn't joking when I said that I couldn't understand which form you were talking about (I'm not a native english speaker), but since you provided much more info about your JavaScript function by now, I can have a look at it.

    Code:
    document.Define.submit();
    This causes the form to submit. After that, the page defined in your action attribute handles the form submit and eventually returns an answering page. From your error description, it looks like you haven't defined a page in your action attribute, so the page submits to itself, i.e. reloads the page (and jumps back to the top).

    If you want to prevent that, remove the code mentioned above. On the other hand, if you want to submit the form if the value of the radio box gets changed, you'll have to keep it, but then you have to use an anchor and redirect the page after loading to it.

    Does that help?

  • #5
    New Coder
    Join Date
    Jul 2002
    Location
    San Francisco
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, slang is a difficult part of language even for native speakers. I should watch my tongue (fingers in this case) and be more precise, maybe use "Within a form..." or something. Sorry.



    Yes, your answer does help. My concern is that using an anchor to redirect the page after loading to it looks bad. It displays the top of the page for a split second, and then you see the jump down.

    Perhaps there is a way to delay the reload so that it has the correct page location before displaying? This might avoid the split-second display of the top?

  • #6
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    can we maybe see the rest of the page?
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #7
    New Coder
    Join Date
    Jul 2002
    Location
    San Francisco
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    too much code to post....

    The page I am using combines several include files/sections. Each submit (including the radio buttons) needs to work independently for each section.

    Is there any way to delay a refresh, I mean, to delay the display, until all of the page pieces are assembled? Then display the page already in its proper below-fold location?

    Anchors are fine, however on all pages they first display the top of the page for a split second, and then jump down to the anchor tag location. The effect is jarring and clunky looking, which is what I am trying avoid.

  • #8
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not that I know of...
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #9
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    zazen, when I try a dummy form with action="formReceive.html#anchorName", the redirect to the anchor is almost instantaneous. However, on my formReceive.html, there is not much markup to render, so the page loads very fast.

    There is a technique for delaying the display of a page. Make the body via CSS invisible (setting the visibility to hidden), and then include this snippet

    Code:
    window.onload = function() {
    	document.body.style.visibility = "visible";
    }
    This works only in modern browsers, i.e. not in NN4.x. And it has the great drawback that all javascript-disabled visitors won't see anything of the page, so consider if that's really worth the trouble...

  • #10
    New Coder
    Join Date
    Jul 2002
    Location
    San Francisco
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ah, javascript-disabled visitors
    the bane of all our javascripting existence!

    I'll give this a try, but probably will go Java.... let me know if you are interested in the solution used and I'll write back.

    Like, thanks.

  • #11
    New Coder
    Join Date
    Jul 2002
    Location
    San Francisco
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Billy Collins, our current U.S. Poet Laureate, likes to take note of the inadvertant haikus which are the result of advertising and popular culture at large. He recently discovered this one while overhearing a conversation between two students at the University where he teaches:

    When she found out she
    was like oh my God and I
    was like oh my God

  • #12
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That's a little too deep (?) for me.
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •