Prado.Element = { /** * Set the value of a particular element. * @param string element id * @param string new element value. */ setValue : function(element, value) { var el = $(element); if(el && typeof(el.value) != "undefined") el.value = value; }, select : function(element, method, value, total) { var el = $(element); var selection = Prado.Element.Selection; if(typeof(selection[method]) == "function") { control = selection.isSelectable(el) ? [el] : selection.getListElements(element,total); selection[method](control, value); } }, click : function(element) { var el = $(element); if(el) Event.fireEvent(el,'click'); }, setAttribute : function(element, attribute, value) { var el = $(element); if((attribute == "disabled" || attribute == "multiple") && value==false) el.removeAttribute(attribute); else if(attribute.match(/^on/i)) //event methods { try { eval("(func = function(event){"+value+"})"); el[attribute] = func; } catch(e) { throw "Error in evaluating '"+value+"' for attribute "+attribute+" for element "+element.id; } } else el.setAttribute(attribute, value); }, setOptions : function(element, options) { var el = $(element); if(el && el.tagName.toLowerCase() == "select") { el.options.length = options.length; for(var i = 0; i)([\\s\\S\\w\\W]*)()',"m"); result = text.match(f); if(result && result.length >= 2) return result[2]; else return null; }, evaluateScript : function(content) { content.evalScripts(); } } Prado.Element.Selection = { isSelectable : function(el) { if(el && el.type) { switch(el.type.toLowerCase()) { case 'checkbox': case 'radio': case 'select': case 'select-multiple': case 'select-one': return true; } } return false; }, inputValue : function(el, value) { switch(el.type.toLowerCase()) { case 'checkbox': case 'radio': return el.checked = value; } }, selectValue : function(elements, value) { elements.each(function(el) { $A(el.options).each(function(option) { if(typeof(value) == "boolean") options.selected = value; else if(option.value == value) option.selected = true; }); }) }, selectValues : function(elements, values) { selection = this; values.each(function(value) { selection.selectValue(elements,value); }) }, selectIndex : function(elements, index) { elements.each(function(el) { if(el.type.toLowerCase() == 'select-one') el.selectedIndex = index; else { for(var i = 0; i