Click to See Complete Forum and Search --> : I'm not sure what it does


xlegend
07-31-2003, 08:28 PM
I'm trying to help a friend with this code... can anyone give me an answer to his problem

Okay......I'm at my wits end. If there are any JavaScript guru's out there let me know. The code below doesnt work right in IE 6, but works grewat in IE 5. Anyone see anything?



var questiontext = form.AssessmentQuestions.options[form.AssessmentQuestions.selectedIndex].text;
var questionlength = questiontext.length;
var MaturityLevelQuestion = form.AssessmentQuestions.options[form.AssessmentQuestions.selectedIndex].text.substring(questionlength-2,questionlength-1);

for (var i = 0; i < form.MaturityLevel.length; i++){
if (form.MaturityLevel.options.selected){
var MaturityLevelAnswer = form.MaturityLevel.options.value;
}
}
if (MaturityLevelAnswer > MaturityLevelQuestion){
error = 1;
results = results + "\n" + "Maturity Level can be no high than " + MaturityLevelQuestion + "!";
}
}
}

How is this fixed?

Khalid Ali
07-31-2003, 10:03 PM
See if you can make any sense out of these lines in your code

form.MaturityLevel.options.selected

And by the way do not name your form object a "form" it could cause some unpredeictable results....

Yogg
07-31-2003, 10:04 PM
Wouldn't this be more logical ?

if (form.MaturityLevel.options[i].selected){
var MaturityLevelAnswer = form.MaturityLevel.options[i].value;
}

xlegend
08-01-2003, 09:54 AM
Sorry. I cut and pasted his message. He did have the [i] included. It still doesn't work in ie6.

My friend suggested

for (var i = 0; i < form.MaturityLevel.length; i++){

to this

for (var i = 6; i < form.MaturityLevel.length; i++){


I don't think that will cause the code to work... but hey

xlegend
08-01-2003, 03:59 PM
"What it's doping though is making the Maturity Level = 0 in the db everytime, but only in IE 6. I don't think it's the VBScript because I already fixed a couple other IE 6 problems that were in the JavaScript."

So he finally said what the problem is. Does anyone know how to solve this?