Index: trunk/extensions/SemanticForms/libs/SemanticForms.js |
— | — | @@ -333,11 +333,11 @@ |
334 | 334 | // Show this div if the current value is any of the relevant options - |
335 | 335 | // otherwise, hide it. |
336 | 336 | function showDivIfSelected(options, div_id, inputVal, instanceWrapperDiv) { |
337 | | - for (var j in options) { |
| 337 | + for ( var i = 0; i < options.length; i++ ) { |
338 | 338 | // If it's a listbox and the user has selected more than one |
339 | 339 | // value, it'll be an array - handle either case. |
340 | | - if ((jQuery.isArray(inputVal) && jQuery.inArray(options[j], inputVal) >= 0) || |
341 | | - (!jQuery.isArray(inputVal) && (inputVal == options[j]))) { |
| 340 | + if ((jQuery.isArray(inputVal) && jQuery.inArray(options[i], inputVal) >= 0) || |
| 341 | + (!jQuery.isArray(inputVal) && (inputVal == options[i]))) { |
342 | 342 | showDiv(div_id, instanceWrapperDiv); |
343 | 343 | return; |
344 | 344 | } |
— | — | @@ -355,7 +355,7 @@ |
356 | 356 | var showOnSelectVals = sfgShowOnSelect[this.attr("id")]; |
357 | 357 | var instanceWrapperDiv = null; |
358 | 358 | } |
359 | | - for (i in showOnSelectVals) { |
| 359 | + for ( var i = 0; i < showOnSelectVals.length; i++ ) { |
360 | 360 | var options = showOnSelectVals[i][0]; |
361 | 361 | var div_id = showOnSelectVals[i][1]; |
362 | 362 | showDivIfSelected(options, div_id, inputVal, instanceWrapperDiv); |
— | — | @@ -365,7 +365,7 @@ |
366 | 366 | // Show this div if any of the relevant selections are checked - |
367 | 367 | // otherwise, hide it. |
368 | 368 | jQuery.fn.showDivIfChecked = function(options, div_id, instanceWrapperDiv) { |
369 | | - for (var i in options) { |
| 369 | + for ( var i = 0; i < options.length; i++ ) { |
370 | 370 | if (jQuery(this).find('[value="' + options[i] + '"]').is(":checked")) { |
371 | 371 | showDiv(div_id, instanceWrapperDiv); |
372 | 372 | return; |
— | — | @@ -384,7 +384,7 @@ |
385 | 385 | var showOnSelectVals = sfgShowOnSelect[this.attr("id")]; |
386 | 386 | var instanceWrapperDiv = null; |
387 | 387 | } |
388 | | - for (i in showOnSelectVals) { |
| 388 | + for ( var i = 0; i < showOnSelectVals.length; i++ ) { |
389 | 389 | var options = showOnSelectVals[i][0]; |
390 | 390 | var div_id = showOnSelectVals[i][1]; |
391 | 391 | this.showDivIfChecked(options, div_id, instanceWrapperDiv); |
— | — | @@ -577,7 +577,7 @@ |
578 | 578 | if ( sfdata && sfdata.validationFunctions.length > 0 ) { // found data object? |
579 | 579 | |
580 | 580 | // for every registered input |
581 | | - for ( var i = 0; i < sfdata.validationFunctions.length; ++i ) { |
| 581 | + for ( var i = 0; i < sfdata.validationFunctions.length; i++ ) { |
582 | 582 | |
583 | 583 | // if input is not part of multipleTemplateStarter |
584 | 584 | if ( jQuery("#" + sfdata.validationFunctions[i].input).closest(".multipleTemplateStarter").length == 0 ) { |
— | — | @@ -656,7 +656,7 @@ |
657 | 657 | // For every initialization method for |
658 | 658 | // input with id old_id, register the |
659 | 659 | // method for the new input. |
660 | | - for ( var i in sfdata.initFunctions[old_id] ) { |
| 660 | + for ( var i = 0; i < sfdata.initFunctions[old_id].length; i++ ) { |
661 | 661 | |
662 | 662 | jQuery(this).SemanticForms_registerInputInit( |
663 | 663 | sfdata.initFunctions[old_id][i].initFunction, |
— | — | @@ -668,7 +668,7 @@ |
669 | 669 | // For every validation method for the |
670 | 670 | // input with ID old_id, register it |
671 | 671 | // for the new input. |
672 | | - for ( var i = 0; i < sfdata.validationFunctions.length; ++i ) { |
| 672 | + for ( var i = 0; i < sfdata.validationFunctions.length; i++ ) { |
673 | 673 | |
674 | 674 | if ( sfdata.validationFunctions[i].input == old_id ) { |
675 | 675 | |
— | — | @@ -734,7 +734,7 @@ |
735 | 735 | if (sfdata) { // if anything registered at all |
736 | 736 | // Call every initialization method |
737 | 737 | // for this input |
738 | | - for ( var i in sfdata.initFunctions[this.id] ) { |
| 738 | + for ( var i = 0; i < sfdata.initFunctions[this.id].length; i++ ) { |
739 | 739 | sfdata.initFunctions[this.id][i].initFunction( |
740 | 740 | this.id, |
741 | 741 | sfdata.initFunctions[this.id][i].parameters |