From: Dion O. <dol...@us...> - 2005-12-02 00:07:35
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20054/magicajax/Core Modified Files: MagicAjaxModule.cs PageFilter.cs Log Message: Made a quick fix for clientside validators in NoStore mode. Index: PageFilter.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/PageFilter.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** PageFilter.cs 23 Nov 2005 19:34:23 -0000 1.2 --- PageFilter.cs 2 Dec 2005 00:07:27 -0000 1.3 *************** *** 27,31 **** string search = "<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\" value=\""; #else ! string search = "<input type=\"hidden\" name=\"__VIEWSTATE\" value=\""; #endif string html = GetHtmlPage(); --- 27,31 ---- string search = "<input type=\"hidden\" name=\"__VIEWSTATE\" id=\"__VIEWSTATE\" value=\""; #else ! string search = "<input type=\"hidden\" name=\"__VIEWSTATE\" value=\""; #endif string html = GetHtmlPage(); *************** *** 41,44 **** --- 41,65 ---- return html.Substring(si, ei - si); } + + /// <summary> + /// Returns the javascript declaration of the 'Page_Validators' array in the output Html + /// </summary> + /// <returns></returns> + public string GetPageValidatorsArray() + { + string search = "Page_Validators = new Array("; + string clearValidatorArray = "Page_Validators = new Array();"; + + string html = GetHtmlPage(); + int si = html.IndexOf(search); + if (si == -1) + return clearValidatorArray; + + int ei = html.IndexOf(");", si); + if (ei == -1) + return clearValidatorArray; + + return html.Substring(si, ei - si + 2); + } #if NET_2_0 Index: MagicAjaxModule.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/MagicAjaxModule.cs,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** MagicAjaxModule.cs 30 Nov 2005 12:22:29 -0000 1.36 --- MagicAjaxModule.cs 2 Dec 2005 00:07:27 -0000 1.37 *************** *** 509,512 **** --- 509,520 ---- AjaxCallHelper.WriteSetFieldScript("__VIEWSTATE", vsValue); } + + // Reset the javascript 'Page_Validators' array on each callback + // Note: this is a temporary solution until we find a better one + string pageValidatorsArray = _filter.GetPageValidatorsArray(); + if (pageValidatorsArray != null) + { + AjaxCallHelper.Write(pageValidatorsArray); + } #if NET_2_0 |