[thelist] Javascript array loop issues?
Tris
beertastic at gmail.com
Thu Oct 29 12:05:43 CDT 2009
Hi all..
Major Javascript woes today...
I'm learning.. well, relearning Ajax.. I've a from that IU wanna
display dynaimic errors..
Anyhoo, I've prepared an array of my errors in an array (inputId : message)
I want to loop through that array, and then IF there's a message
value, then echo it...
For this example, i'm just echoing some alerts.. but I'm not getting any...
What ROOKIE mistake am I making today? ;-p
Peace and love...
Tris..
==================================
<script type="text/javascript">
alert('start');
var getErrors = new Array();
var getErrors = {"lookingWhat":"Who are you looking for?",
"genderWhat":"What gender are you?",
"passwordDifferent":"",
"emailRegistered":"",
"emailInvalid":"Invalid Email Address",
"FieldsEmpty":"Pleace complete all fields"};
for (i=0;i<getErrors.length;i++) {
for(getErrors in value) {
var getKey = $('#'+getErrors[i]);
var getVal = value[i];
if (getVal.val() == '') {
alert('is an error');
} else {
alert('no error');
}
}
}
alert('end');
</script>
More information about the thelist
mailing list