ClientValidationFunction によってクライアント側で customvalidator メッセージを動的に変更したい。私が持っているJavaスクリプトでは:
function valnationalid(source, arguments) {
if (arguments.Value == ""){
source.errormessage = "custom message here";
arguments.IsValid = false;
} else if (arguments.Value == "Something else"){
source.errormessage = "another custom message here";
arguments.IsValid = false;
}
}
そして体内:
<input runat="server" id="txtnationalid" maxLength="10" name="txtnationalid" class='person ltr glow-onfocus customerCode required number' dir="ltr" />
<asp:CustomValidator ID="valnationalid1" runat="server" EnableClientScript="true" ClientValidationFunction="valnationalid" ValidateEmptyText="True" Display="Dynamic" ControlToValidate="txtnationalid"> </asp:CustomValidator>
しかし、私のページにはメッセージが表示されません。