•
•
•
•
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 425,956 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 1,646 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: 1034 | Replies: 1
![]() |
•
•
Join Date: Nov 2007
Posts: 86
Reputation:
Rep Power: 1
Solved Threads: 6
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.
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
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
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Another IE6 bug? Or coding mistake? (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: image preview , ajax responce img path got extra '/'
- Next Thread: calling a function in url


Linear Mode