Hi all,
At work, we are using prototype vs 1.5 (don't know the sub version off hand).
I have been doing all of my development in firefox. The problem is almost 80% of our site's users use IE6 or IE7, and since they are on their company computers, they do not have the leasure of switching over to FF at will.

Here is the script that I am working with.

function SourceRequire(){
	if ((this.value != "") && (!this.soi)){
		this.soi = arReqFields.length;
		if (this.id == 'MonthlyIncome') {
		arReqFields.push([$('SourceofIncome_List').id, "Source of Income 1"]);
		}
		if (this.id == 'MonthlyIncome2') {
		arReqFields.push([$('SourceofIncome2_List').id, "Source of Income 2"]);
		}
	} else if ((this.value == "") && (this.soi)){
		arReqFields.splice(this.soi, 1);
		this.soi = false;
	}
	
}
function incomeSourceRequired()
{
	
	Event.observe($('MonthlyIncome'), 'blur', SourceRequire, false);
	Event.observe($('MonthlyIncome2'), 'blur', SourceRequire, false);

}

Here is what is happening. arReqFields is an array which is checked against for required fields on submit. Due to the nature of the project, I can not actually make changes to arReqFields (it's part of core code which I am not allowed to change). So, I am using the blur event here to add to the array or take away from the array as needed so that these items will be there when the form is submitted.

These fields are conditionally required as follows.
If the value of the field with the id MonthlyIncome is not empty then require that SourceofIncome_List also not be null. The reverse is not true, they can have a sourceofIncome without adding their MonthlyIncome.

The same requirements here should be set to MonthlyIncome2 and SourceofIncome2_List

My above code works wonderfully in FireFox, but not at all in Explorer.

Keep in mind, my javascript is not really up to par, I am learning a lot as I go, and really only recently have an understanding about how arrays work.
So, what I am doing is counting the length of the arReqFields and on blur adding the information then giving an index to this item of the length (since if the length is 4 then the next available index should also be 4 (with 0 being the first index in the array).

Maybe this is too much information or not enough? I don't know, but, I am really wondering, what is the problem with IE here? I do not get a javascript error at all in IE.

Thanks in advance
Sage

I should mention, my last statement "I do not get javascript error at all in IE". What I mean is that, the code simply works as it should in FF with no errors, but, doesn't do anything at all in IE. It treats it as if it's not even there, no errors or anything.

This article has been dead for over six months. Start a new discussion instead.