Hi,
I have one odd problem!
If I add a RadScriptManager on the page all client side validation stop working.
What have I missed?
Testcode:
Result:
Result without scriptmanager, now the validator works:
I have one odd problem!
If I add a RadScriptManager on the page all client side validation stop working.
What have I missed?
Testcode:
%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="App.Web.UI.Administration.Secure.test" %> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title></title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"> |
</telerik:RadScriptManager> |
<div> |
<table class="form"> |
<tr> |
<td class="red">Namn:</td> |
<td><asp:TextBox ID="textBoxName" runat="server" CssClass="xLarge" ValidationGroup="validationGroupBanner"></asp:TextBox> |
<asp:RequiredFieldValidator ID="requiredFieldValidatorName" runat="server" |
ControlToValidate="textBoxName" Display="Dynamic" ErrorMessage="obligatorisk" |
SetFocusOnError="True" ValidationGroup="validationGroupBanner"></asp:RequiredFieldValidator> |
</td> |
</tr> |
</table> |
</div> |
</form> |
</body> |
</html> |
Result:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head><title> |
</title></head> |
<body> |
<form name="form1" method="post" action="test.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1"> |
<div> |
<input type="hidden" name="RadScriptManager1_HiddenField" id="RadScriptManager1_HiddenField" value="" /> |
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" /> |
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" /> |
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTM2MDkyOTg3MGRkKKxwM9OSYlk1EpTM5Wl6MC4iboc=" /> |
</div> |
<script type="text/javascript"> |
//<![CDATA[ |
var theForm = document.forms['form1']; |
if (!theForm) { |
theForm = document.form1; |
} |
function __doPostBack(eventTarget, eventArgument) { |
if (!theForm.onsubmit || (theForm.onsubmit() != false)) { |
theForm.__EVENTTARGET.value = eventTarget; |
theForm.__EVENTARGUMENT.value = eventArgument; |
theForm.submit(); |
} |
} |
//]]> |
</script> |
<script src="/WebResource.axd?d=PJbs5I8u7UnXghzYecrYew2&t=633527857956801634" type="text/javascript"></script> |
<script src="/ScriptResource.axd?d=7ZfBM6SkJ6AkD6NPKf2D84lP3jDRYRutI_sNsAMiNpP9Ndvl6rKJDioozY5LQgGdlUnZK2zCZizinGUlzrFvQA2&t=633527857956801634" type="text/javascript"></script> |
<script src="/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_HiddenField&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d1.0.61025.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a1f0f78f9-0731-4ae9-b308-56936732ccb8%3a52817a7d%3a67c678a8" type="text/javascript"></script> |
<script type="text/javascript"> |
//<![CDATA[ |
function WebForm_OnSubmit() { |
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false; |
return true; |
} |
//]]> |
</script> |
<div> |
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgLcrOGFAgKPlYESheV+n5Sp2a2I8UvaK2DAJ589lhU=" /> |
</div> |
<script type="text/javascript"> |
//<![CDATA[ |
Sys.WebForms.PageRequestManager._initialize('RadScriptManager1', document.getElementById('form1')); |
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90); |
//]]> |
</script> |
<div> |
<table class="form"> |
<tr> |
<td class="red">Namn:</td> |
<td><input name="textBoxName" type="text" id="textBoxName" class="xLarge" /> |
<span id="requiredFieldValidatorName" style="color:Red;display:none;">obligatorisk</span> |
</td> |
</tr> |
</table> |
</div> |
<script type="text/javascript"> |
//<![CDATA[ |
var Page_Validators = new Array(document.getElementById("requiredFieldValidatorName")); |
//]]> |
</script> |
<script type="text/javascript"> |
//<![CDATA[ |
var requiredFieldValidatorName = document.all ? document.all["requiredFieldValidatorName"] : document.getElementById("requiredFieldValidatorName"); |
requiredFieldValidatorName.controltovalidate = "textBoxName"; |
requiredFieldValidatorName.focusOnError = "t"; |
requiredFieldValidatorName.errormessage = "obligatorisk"; |
requiredFieldValidatorName.display = "Dynamic"; |
requiredFieldValidatorName.validationGroup = "validationGroupBanner"; |
requiredFieldValidatorName.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; |
requiredFieldValidatorName.initialvalue = ""; |
//]]> |
</script> |
<script type="text/javascript"> |
//<![CDATA[ |
var Page_ValidationActive = false; |
if (typeof(ValidatorOnLoad) == "function") { |
ValidatorOnLoad(); |
} |
function ValidatorOnSubmit() { |
if (Page_ValidationActive) { |
return ValidatorCommonOnSubmit(); |
} |
else { |
return true; |
} |
} |
Sys.Application.initialize(); |
document.getElementById('requiredFieldValidatorName').dispose = function() { |
Array.remove(Page_Validators, document.getElementById('requiredFieldValidatorName')); |
} |
//]]> |
</script> |
</form> |
</body> |
</html> |
Result without scriptmanager, now the validator works:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head><title> |
</title></head> |
<body> |
<form name="form1" method="post" action="test.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="form1"> |
<div> |
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJNjE1MzQwNzgzZGQUXdcWlpAsgxQEdMt/9c9OtbGOYg==" /> |
</div> |
<script src="/WebResource.axd?d=S67xmpnCynrpCGuTG1uCu5qbsb48xm5XkXRTyH8bt181&t=633527857956801634" type="text/javascript"></script> |
<script type="text/javascript"> |
//<![CDATA[ |
function WebForm_OnSubmit() { |
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false; |
return true; |
} |
//]]> |
</script> |
<div> |
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgKYhNfGBgKPlYESviUaHFwOJ+saekYypJvt3mDGaP4=" /> |
</div> |
<div> |
<table class="form"> |
<tr> |
<td class="red">Namn:</td> |
<td><input name="textBoxName" type="text" id="textBoxName" class="xLarge" /> |
<span id="requiredFieldValidatorName" style="color:Red;display:none;">obligatorisk</span> |
</td> |
</tr> |
</table> |
</div> |
<script type="text/javascript"> |
//<![CDATA[ |
var Page_Validators = new Array(document.getElementById("requiredFieldValidatorName")); |
//]]> |
</script> |
<script type="text/javascript"> |
//<![CDATA[ |
var requiredFieldValidatorName = document.all ? document.all["requiredFieldValidatorName"] : document.getElementById("requiredFieldValidatorName"); |
requiredFieldValidatorName.controltovalidate = "textBoxName"; |
requiredFieldValidatorName.focusOnError = "t"; |
requiredFieldValidatorName.errormessage = "obligatorisk"; |
requiredFieldValidatorName.display = "Dynamic"; |
requiredFieldValidatorName.validationGroup = "validationGroupBanner"; |
requiredFieldValidatorName.evaluationfunction = "RequiredFieldValidatorEvaluateIsValid"; |
requiredFieldValidatorName.initialvalue = ""; |
//]]> |
</script> |
<script type="text/javascript"> |
//<![CDATA[ |
var Page_ValidationActive = false; |
if (typeof(ValidatorOnLoad) == "function") { |
ValidatorOnLoad(); |
} |
function ValidatorOnSubmit() { |
if (Page_ValidationActive) { |
return ValidatorCommonOnSubmit(); |
} |
else { |
return true; |
} |
} |
//]]> |
</script> |
</form> |
</body> |
</html> |