User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 401,520 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,371 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 956 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 86
Reputation: sagedavis is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
sagedavis sagedavis is offline Offline
Junior Poster in Training

Help need IE7 help using prototype

  #1  
Feb 16th, 2008
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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2007
Posts: 86
Reputation: sagedavis is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 6
sagedavis sagedavis is offline Offline
Junior Poster in Training

Re: need IE7 help using prototype

  #2  
Feb 17th, 2008
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.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 2:54 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC