I have a form that "activates" the submit button; switching a greyed out version that does nothing for the working one, when all the fields are correctly filled in. The problem arises in IE 7 when the submit button is supposed to be activated. The greyed one disappears, but the real one doesn't appear.

//Define Submit Buttons----------------------------------------------------------------
	submit = document.getElementById('submit'); 
        submitNull = document.getElementById('submitNull');
//Error checker and button revealer
function errorCheck() {
	var execute = true;
	for(i = 0; i < 4; i++) {
		if(errors[i] === true) execute = false;}
	if(execute === true) {regKeyCheck();}}
function regKeyCheck() {
	if(BrowserDetect.browser != "Explorer") {
		var valid = document.getElementById('keyFrame').contentWindow.document.getElementById("keyCheck").value;
		var key = document.getElementById('keyFrame').contentWindow.document.getElementById('regKey1').value;}
	else {
		var valid = window.frames['keyFrame'].document.getElementById("keyCheck").value;
		var key = window.frames['keyFrame'].document.getElementById("regKey1").value;}
	if(valid == "true") {
		document.getElementById('hiddenKey').value = key;
		submitNull.style.display = "none";
		submit.style.display = "block";
		submit.onclick = function() {document.getElementById('form').submit();}
		}
	}

Recommended Answers

All 5 Replies

bump

did you try assigning it different style values? inline for example?

Did you try with the visibility style?

visibility: hidden;
visibility: visible;

Cloud09,

First, avoid the variable name submit . It may be regarded as a keyword (because submit() is a method of form).

Second, you should be able to use submitButton.disabled = true; and submitButton.disabled = false; without needing to switch between different butons.

Third, if you really need to switch buttons and "block" rendering is required, then wrap your buttons in eg. <div id="submitwrapper_0">...</div> and <div id="submitwrapper_1">...</div> . Then set their style.display to 'none' | 'block' rather than styling the buttons themselves.

Airshow

I found the problem was that it didn't like the variable "submit". I have to use display="none", and display="block" because the button I am using is a custom submit button that is a div (with a bg image that changes using css) that submits the form when clicked (using javascript).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.