0

Could you please suggest if I did right?

The case is that I have an HTML form, and each time I click anywhere within the form boundaries, even on empty spaces between controls, the screen jumps to the top of the form. Once again, it's only happening with IE.

At first I thought it's related to some JQuery listeners, but when I removed all the links to JQuery it still kept on happening.

So what I did is adding onclick="return false" to the form attributes. It stopped the mentioned above screen jumping and all the JQuery/PHP functions kept working fine.

What I wanted to ask whether there are negative reflections of the way that I solved this issue?

Thanks in advance,

EP

3
  • 2
    Could it be an unclosed <a name= tag?
    – user527892
    Sep 5, 2012 at 14:41
  • In order to really help here, we would need to see what you've tried. Thanks
    – Chase
    Sep 5, 2012 at 14:42
  • Thanks for the reply guys, the form is about 1000 lines I think it will be difficult to post it here, but I will check all the tags for proper layout, thanks Scott Brown.
    – LazyZebra
    Sep 5, 2012 at 14:45

2 Answers 2

2

Even if your solution apparently solves the problem, it's very likely that the issue is still just hidden.

Try identifying any onclick events attributed to your <body> or <form> elements, disable them and then try again.

You will most likely bump into this solution later down the road and it's going to cause headaches you can avoid by doing some more digging now.

UPDATE: Try validating your code http://validator.w3.org/

3
  • thank you, you are right, I will dig deeper in to the issue. I don't like late headaches :)
    – LazyZebra
    Sep 5, 2012 at 14:46
  • I've checked - I have no problematic onclick events on the form, the code validator didn't pass because there's many controls created by php echo, and all the glyphs are ruining the validation.
    – LazyZebra
    Sep 5, 2012 at 15:46
  • 1
    found the problem, this is so stupid: i was missing a closing <label> tag at the top of the form. Missed it because it is dynamically generated. <span style="margin-left: 8px;">Logged in as<?php echo "<label id='lbl_aa_name' name='lbl_aa_name' value='$aa_login'> $aa_login"?>**</label>**</span>
    – LazyZebra
    Sep 5, 2012 at 17:17
0

By placing onclick="return false" on the <form /> element you will disable the submit button.

Demo Here

1
  • Thank you, on this specific form I don't have any type=submit buttons.
    – LazyZebra
    Sep 5, 2012 at 14:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.