Hi.
I'm using LiveValidation for input elements. These come in a table retrieved with an AJAX call, and can be multiples of 4, anywhere between 4 and 36.
I'm using eval to call the constructor for LiveValidation as the number of input elements can vary after each AJAX call and I couldn't think of another way (I don't have much experience with JavaScript).
I'm using this:
$("input[type=text]", tableElement).each(function(index) {
eval("var temp_" + index + " = new LiveValidation(this, { wait: 0, validMessage: ' ' });");
eval("temp_" + index + ".add(Validate.Numericality, { onlyInteger: true });");
eval("temp_" + index + ".add(Validate.Presence, { failureMessage: 'Cannot be blank' });");
});
What would be a better way of doing achieving the same without the use of eval as I know it should be used very sparingly.