You are currently viewing the BOOK: Beginning ASP.NET 4.5 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
CustomValidator client validation function not working
Hi,
After reading your book, I write a small website to applied what I learned, but somehow the client validation function is not running... only the server side is running.
Below is the source view of the page on the javascript:
<script type="text/javascript">
function validateCentreName(source, args)
{
var centreNameText = document.getElementById('cpMainContent_CentreNameT ext');
Below is the source view of the page on the custom validation control: <input name="ctl00$cpMainContent$CentreNameText" type="text" maxlength="100" id="cpMainContent_CentreNameText" style="width:500px;" />
<span data-val-errormessage="Enter centre name" data-val-display="Dynamic" id="cpMainContent_CentreNameValidator" class="ErrorMessage" data-val="true" data-val-evaluationfunction="CustomValidatorEvaluateIsValid " data-val-clientvalidationfunction="validateCentreName" style="display:none;">*</span>