0

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();}
		}
	}
4
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by cloud09
0

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

Edited by Airshow: n/a

0

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).

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.