HTML/Javascript problem

Leo_Feldborg
Leo_Feldborg used Ask the Experts™
on
Hi

I have a questionnaire that has been working for two years now. Suddenly some users have started getting a mystical problem with it. I have checked the html and javascript code several times but cannot find any answer to the problem.

I have made a comprimised version here:
http://www.webanalyser.dk/testquest.html

Now to the problem...
After answering the first question it should (as it has always been doing) go to the next page. For most users it does, but now out of a sudden - for some users - when you click Next after the first question it jumps to end and tell that the "Last question has been answered, will you submit?". If you press OK it submits.

All the users are using MSIE 7-8. Check the code and help me...

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Web Programmer/Technician
Commented:
Is it possible the users are pressing the enter key after entering their reg number? The form is being submitted by the enter key. You may want to add an onsubmit event to the form to confirm that all the pages have been answered before submitting. I don't see an actual submit button nor do I see any javascript to submit the form.

Other than submitting when I press enter, the form paged correctly in IE7.
Anuradha GoliSystems Development / Support Specialist

Commented:
Can you just try changing " input type = "submit " " from  " input type = "button" "
for next and  previous buttons
Robert SchuttSoftware Engineer
Commented:
> for some users

Is there any way you can determine which users, what's the difference? Is it always the case for them, in other words: is it reproducable?
One thing I noticed is that you use
.getAttribute("name")

Open in new window

on a span, if that is somehow not working on a particular browser (it works fine for me on latest IE, FireFox and Chrome) then the function countPages() fails and produces the exact result you see of skipping to the submit. So maybe it's possible to use id instead of name? Since they're both set anyway.

Unrelated but also: there's a typo which has been copied a number of times: <meta http-equic=...>

Author

Commented:
Thank you so much :-) It was the Enter problem.

And thank you Robert, for your comments. They were useful - although not for the problem ;-)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial