Please show the code in question (view-source html pasted into the "code" attachment box
Main Topics
Browse All TopicsGreetings,
I have a registration page where a user fills his details and becomes a member of the site. In order to validate the details entered before going to the server I use Javascript. Therefore, the 'Submit' button that POSTS the FORM is not really a type="Submit" button but a type="button" button which is initially hidden with an onClick="validate()" assosiated with it. Of course that would work only for browsers that have javascript enabled. So, I had to also provide another button (type="submit" this time) for the browsers that have javascript disabled. So, when javascript is enabled, the javascript code "unhides" the submit button while when javascript is disabled the type="submit" button is shown (it rests inside<noscript></noscript
The above scenario works great in Firefox but not too good in Internet Explorer (what a surprise?). Firefox handles great both javascript enabled/disabled situations. The problem is when I use IE6 with javascript enabled. Since javascript is enabled the noscript content has no reason to execute and that's fine. However, the hidden button which should "unhide" during onload does not "unhide" unless I refresh the page (F5).
Therefore, IE6 leves me with no button at all to submit the form when javascript is enabled.
Seems as if onLoad did not run the first time a page is called but the it runs when the page is refreshed. Does anybody know anything on this matter?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Oli,
it does not seem to work for me:
the line of code I was using was:
document.registration.subm
(registration is the form name and submitButton the input name)
in the jsp the submitButton is declared as class="hidden" therefore when js removes the class the button stops being 'hidden'.
so I changed it regarding your advice to:
document.registration.subm
The result is that nothing different happens.
The new code works fine with firefox while I need to hit f5 to see the button in IE6.
That did the trick!
With a little correction: I had to enclose the function call in parentheses. So, it became
<FORM onsubmit="return(validate(
Also, I only kept the type="Submit" button as you said.
After that, it worked, but initially I had a weird problem: if I entered invalid values in the form and attempted to submit it (which should result in the form NEVER being submitted to the server) the form was submitted to the server as if the validation was successful. To fix this I replaced the lines below:
if(formIsValid)
{
form.submit();
}
with the lines:
if(formIsValid)
{
form.submit();
}else
{
return false;
}
and it worked fine.
Thanks for the help mplungjan !
Business Accounts
Answer for Membership
by: oheilPosted on 2009-11-03 at 05:24:40ID: 25728631
We solve this problem using style="display:none" and style="display:inline".
1); 3);
If javascript is enabled all elements which should show up are set by javascript to inline with the commands:
link = document.getElementById(id
link.style.display = "inline";
or
image = document.getElementById(id
image.style.display = "inline";
the others, which should only show up, if javascrip is disabled are set to none with:
image.style.display = "none";
This works stable in firefox an internet explorer (tested with 6 and above).
Perhaps this helps,
Oli