From: Argiris K. <be...@us...> - 2006-02-09 13:41:11
|
Update of /cvsroot/magicajax/magicajax/Core/script In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13863/Core/script Modified Files: AjaxCallObject.js Log Message: --If another form tag was added to page, MagicAjax did not work; fixed it --Corrected an encoding issue (solution provided by erivas) --Some controls with AutoPostBack set to 'true' were not working properly; fixed it --Set the version number to 0.3.0 Index: AjaxCallObject.js =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** AjaxCallObject.js 8 Feb 2006 20:49:43 -0000 1.55 --- AjaxCallObject.js 9 Feb 2006 13:41:00 -0000 1.56 *************** *** 1,3 **** --- 1,4 ---- __AJAXCboList = new Array(); + __PageForm = null; __bPageIsStored = false; __bUnloadStoredPage = false; *************** *** 217,227 **** } ! AjaxCallObject.prototype.HookAjaxCall = function(bPageIsStored, bUnloadStoredPage, bTracing) { __IsIE = navigator.appName.indexOf("Internet Explorer") != -1; __IsOpera = window.opera ? true : false; ! ! this.AddEventListener(document.forms[0], "submit", this.OnFormSubmit); ! this.AddEventListener(document.forms[0], "click", this.OnFormClick, true); if (typeof __doPostBack != 'undefined') --- 218,231 ---- } ! AjaxCallObject.prototype.HookAjaxCall = function(bPageIsStored, bUnloadStoredPage, bTracing, pageFormID) { __IsIE = navigator.appName.indexOf("Internet Explorer") != -1; __IsOpera = window.opera ? true : false; ! __PageForm = document.getElementById(pageFormID); ! ! if (__PageForm == null) return; ! ! this.AddEventListener(__PageForm, "submit", this.OnFormSubmit); ! this.AddEventListener(__PageForm, "click", this.OnFormClick, true); if (typeof __doPostBack != 'undefined') *************** *** 303,307 **** { __doingSubmit = true; ! AJAXCbo.DispatchEvent(document.forms[0], "submit"); __doingSubmit = false; --- 307,311 ---- { __doingSubmit = true; ! AJAXCbo.DispatchEvent(__PageForm, "submit"); __doingSubmit = false; *************** *** 344,349 **** if (typeof(WebForm_OnSubmit)=="function") { ! var theForm = document.forms[0]; ! if (theForm.onsubmit && (theForm.onsubmit() == false)) return; } --- 348,352 ---- if (typeof(WebForm_OnSubmit)=="function") { ! if (__PageForm.onsubmit && (__PageForm.onsubmit() == false)) return; } *************** *** 416,428 **** return; ! if (document.forms[0]["__AJAX_PAGEKEY"] == null) return; ! var thePage = document.forms[0].action; var index = thePage.indexOf("?"); if (index != -1) thePage = thePage.substring(0, index); ! thePage = thePage + "?__AJAX_PAGEUNLOAD=" + encodeURIComponent(document.forms[0]["__AJAX_PAGEKEY"].value); var oThis = AJAXCbo; --- 419,431 ---- return; ! if (__PageForm["__AJAX_PAGEKEY"] == null) return; ! var thePage = __PageForm.action; var index = thePage.indexOf("?"); if (index != -1) thePage = thePage.substring(0, index); ! thePage = thePage + "?__AJAX_PAGEUNLOAD=" + encodeURIComponent(__PageForm["__AJAX_PAGEKEY"].value); var oThis = AJAXCbo; *************** *** 449,453 **** var theData = ''; ! var theform = document.forms[0]; var thePage = theform.action; var eName = ''; --- 452,456 ---- var theData = ''; ! var theform = __PageForm; var thePage = theform.action; var eName = ''; *************** *** 821,825 **** scriptHolder.setAttribute(scriptAttributes[i], scriptAttributes[i+1]); ! document.forms[0].appendChild(scriptHolder); } --- 824,828 ---- scriptHolder.setAttribute(scriptAttributes[i], scriptAttributes[i+1]); ! __PageForm.appendChild(scriptHolder); } *************** *** 832,836 **** hiddenField.value = elementValue; ! document.forms[0].appendChild(hiddenField); } --- 835,839 ---- hiddenField.value = elementValue; ! __PageForm.appendChild(hiddenField); } *************** *** 845,849 **** AjaxCallObject.prototype.SetField = function(fieldName, fieldValue) { ! var field = document.forms[0][fieldName]; if (field != null) field.value = fieldValue; --- 848,852 ---- AjaxCallObject.prototype.SetField = function(fieldName, fieldValue) { ! var field = __PageForm[fieldName]; if (field != null) field.value = fieldValue; *************** *** 904,908 **** AjaxCallObject.prototype.SetFieldIfEmpty = function(fieldName, fieldValue) { ! var field = document.forms[0][fieldName]; if (field != null && field.value == '') field.value = fieldValue; --- 907,911 ---- AjaxCallObject.prototype.SetFieldIfEmpty = function(fieldName, fieldValue) { ! var field = __PageForm[fieldName]; if (field != null && field.value == '') field.value = fieldValue; |