Groups > Asp .Net > ASP.NET Atlas Framework discussion > custom validation not working




custom validation not working

custom validation not working
Wed, 27 Sep 2006 20:03:17 +000
hi guys just wondering if you could help me with this, i am trying to write a
custom validator for my atlas page but it does not seem to work, when the text
field is empty the page gets submitted, code is show below. This must be a
custom validator as i wish to add addtional code otherwise i would of used the
RequiredFieldValidation control.

thanks

 

 

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="
Default.aspx.cs"Inherits="_Default" %>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML
1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">

<title>Untitled Page</title>

<atlas:ScriptManagerID="myscript"runat="server"></a
tlas:ScriptManager>

<scriptlanguage="javascript">

function ValidateForm(source,arguments)

{

 

var sText=document.getElementById("name").value;

 

if (sText == "") 

{

arguments.IsValid = false;

return;

}

 

return;

}

</script>

 

</head>

<body>

<formid="form1"runat="server">

 

<div>

 

<atlas:UpdatePanelID="updater"runat="server">

<ContentTemplate>

<inputtype="text"id="name"runat="server"/>

<asp:CustomValidatorid="valCustom"runat="server"

ControlToValidate="name"

ClientValidationFunction="ValidateForm"

ErrorMessage="This box is not valid">

</asp:CustomValidator>

 

</ContentTemplate>

<Triggers>

<atlas:ControlEventTriggerControlID="send22"EventName="Click&q
uot;/>

</Triggers>

</atlas:UpdatePanel>

 

 

 

 

</div>

<div>

<asp:ButtonID="send22"Text="send"OnClick="process&qu
ot;runat="server"/>

 

 

</div>

</form>

 

</body>

</html>
Post Reply
about | contact