Update of /cvsroot/magicajax/magicajax/Core/script
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4658/Core/script
Modified Files:
Tag: STABLE
AjaxCallObject.js
Log Message:
--Single-selection listbox and dropdownlist were not cleared for firefox; fixed it.
--Optimization changes to the DoAjaxCall function, provided by Eyal Mey-Tal.
Index: AjaxCallObject.js
===================================================================
RCS file: /cvsroot/magicajax/magicajax/Core/script/AjaxCallObject.js,v
retrieving revision 1.30
retrieving revision 1.30.4.1
diff -C2 -d -r1.30 -r1.30.4.1
*** AjaxCallObject.js 5 Dec 2005 18:40:50 -0000 1.30
--- AjaxCallObject.js 13 Dec 2005 06:25:31 -0000 1.30.4.1
***************
*** 258,264 ****
theData += '__VIEWSTATE=' + this.EncodePostData(theform.__VIEWSTATE.value) + '&';
! for( var i=0; i<theform.elements.length; i++ )
{
! eName = theform.elements[i].name;
if( eName && eName != '')
{
--- 258,266 ----
theData += '__VIEWSTATE=' + this.EncodePostData(theform.__VIEWSTATE.value) + '&';
! var elemCount = theform.elements.length;
! for( var i=0; i<elemCount; i++ )
{
! curElem = theform.elements[i];
! eName = curElem.name;
if( eName && eName != '')
{
***************
*** 267,298 ****
// Do Nothing
}
! else if (theform.elements[i].getAttribute("ExcludeFromPost") == null || theform.elements[i].getAttribute("ExcludeFromPost").toLowerCase() != "true")
{
! var type = theform.elements[i].type;
! var val = theform.elements[i].value;
if ( type == "submit" || type == "button" )
continue;
- if ( type == "textarea" )
- {
- // Firefox has the bad habit of altering the "\r\n" of a textarea to "\n",
- // so convert all single "\n" to "\r\n"
- val = val.split("\r\n").join("\n").split("\n").join("\r\n");
- }
-
val = this.EncodePostData(val);
if ( type == "select-multiple" || type == "select-one" )
{
! for (var j=0; j < theform.elements[i].options.length; j++)
! if (theform.elements[i].options[j].selected)
! theData = theData + this.EncodePostData(eName) + '=' + this.EncodePostData(theform.elements[i].options[j].value) + '&';
}
! else if ( (type != "checkbox" && type != "radio") || theform.elements[i].checked )
{
! theData = theData + this.EncodePostData(eName) + '=' + val;
! if( i != theform.elements.length - 1 )
! theData = theData + '&';
}
}
--- 269,293 ----
// Do Nothing
}
! else if (curElem.getAttribute("ExcludeFromPost") == null || curElem.getAttribute("ExcludeFromPost").toLowerCase() != "true")
{
! var type = curElem.type;
! var val = curElem.value;
if ( type == "submit" || type == "button" )
continue;
val = this.EncodePostData(val);
if ( type == "select-multiple" || type == "select-one" )
{
! var selectLength = curElem.options.length;
! var optNameStr = this.EncodePostData(eName);
! for (var j=0; j < selectLength; j++)
! if (curElem.options[j].selected)
! theData = theData + optNameStr + '=' + this.EncodePostData(curElem.options[j].value) + '&';
}
! else if ( (type != "checkbox" && type != "radio") || curElem.checked )
{
! theData = theData + this.EncodePostData(eName) + '=' + val + '&';
}
}
***************
*** 547,551 ****
AjaxCallObject.prototype.EncodeTraceData = function(data)
{
! return data.split("<").join("<").split(" ").join(" ").split("\r\n").join("<br>");
}
--- 542,546 ----
AjaxCallObject.prototype.EncodeTraceData = function(data)
{
! return data.split("<").join("<").split(" ").join(" ").split("\n").join("<br>");
}
|