views:

22

answers:

1

I have this security question answer input field validate function where I want to make sure the string are converted to lowercase just in case a user enter a answer in caps in the first field and in small case in the second field:

validate : function(){
//check if both input fields are not blank
//if not blank, check to see if they match and send back status message
var _inputs = dojo.query("#" + this.id + " input");
var _y = ""
var _matchingValues = [];
 _this = this;
 for(var i = 0, len = _inputs.length; i < len; i++) {
  _matchingValues.push(_inputs[i].value);
 }
 dojo.forEach(_matchingValues, function(arr) {
   if (arr == "") {
    _this.status = "incomplete";
    //_this.status = "invalid";
    return _this.status;
   }

   else if (arr != _y) {
   _y = arr;                 
   _this.status = "nomatch";
     return _this.status;
   }

   else if (arr.length < 3){
    _this.status = "short";
    return _this.status;
   }

   else {

     _this.status = "valid";
     return _this.status;
   }
  });
 },  

How can this be accomplished

+1  A: 
_matchingValues.push(_inputs[i].value);

You can change this so it only pushes the lowercase values before you perform your comparison.

_matchingValues.push(_inputs[i].value.toLowerCase());
t3hb4tman
This worked after I rebuilt the dojo profiles
Amen