PDA

View Full Version : YAHOO.ext.Element.get().getAttribute() causes errors



angusf
12 Oct 2006, 8:34 PM
function sendPaneForm(p_form) {
var theForm = document.getElementById(p_form); // this works
// var theForm = YAHOO.ext.Element.get(p_form); // this DOES NOT WORK

var bottom = YAHOO.ext.Element.get('bottomPane');
var updateMgr = bottom.getUpdateManager();

var failedLoad = function() {
bottom.update("Failed to send form");
};
var okLoad = function() {

};
updateMgr.onFailure.subscribe(failedLoad);
updateMgr.onUpdate.subscribe(okLoad);

updateMgr.formUpdate(theForm, null, true, null);
}


The line commented out, using YAHOO.ext.Element.get() , causes an error to occur in yui-ext.32.1/yui-ext.js at line 123 where getAttribute is used to determine the enctype.

Is there any way to use YAHOO.ext.Element to pass the form to the updateManager or do I need to revert to using document.getElementById

I'm new to javascript but one of the reasons I understood using YUI & YUI.ext might be a good idea was to easily overcome browser compatibility problems. Is there any problem using getElementById or is there a way to get element attributes using YAHOO.ext.Element?

Thanks for your help.

Frank
26 Mar 2007, 11:46 PM
you should access the element's dom ,like this
getEl('foo').dom.getAttribute('Attribute_name')