function Form() { this.form=null; //this.tooltip_name=null; //this.error_message=[]; this.error_object=[]; this.error_message_id=null; this.error_box_id=null; this.invalid_color="#ffe8e8"; this.valid_color="#ffffff"; this.invalid_text_color="red"; } Form.prototype = { setForm: function(f) { this.form=f; }, setErrorMessageID: function (id) { this.error_message_id=id; }, setErrorBoxID: function (id) { this.error_box_id=id; }, setElementErorrBox: function(e, show) { var error_id=e.getAttribute("error_message_id") var message=e.getAttribute("error_message") var error_box=document.getElementById(error_id); if (show) { e.style.background=this.invalid_color; if (error_id!=null && message!=null) { if (error_box!=null) { error_box.innerHTML=message; error_box.style.color=this.invalid_text_color; } } } else { e.style.background=this.valid_color; if (error_box!=null) { error_box.innerHTML=""; } } }, getErrorCount: function() { return this.error_object.length; }, showElementsErrorMessage: function() { /* show individual elements' error message into individual id box */ var i, o, error_box, error_id,message; for (i=0; i"); box.style.display=""; }, hideErrorMessage: function() { var box=document.getElementById(this.error_box_id); //var message=document.getElementById(this.error_message_id); //message.innerHTML=this.error_message.join("
"); box.style.display="none"; }, validateAllInput: function() { var e, i, check, j; //var elements=this.form.getElementsByTagName("input"); var elements=this.form; check=true; var error_object=[]; for (i=0; i=min) { return true; } return false; }, isSelected: function(object) { if (object.options[object.selectedIndex].value=="") { return false; } return true; }, trim: function (stringToTrim) { return stringToTrim.replace(/^\s+|\s+$/g,""); }, ltrim: function(stringToTrim) { return stringToTrim.replace(/^\s+/,""); }, rtrim: function(stringToTrim) { return stringToTrim.replace(/\s+$/,""); } }