G
Guest
Hi all,
Hoping someone can help me w/an annoying issue.
I'm using a CustomValidator to check the length of a value in a textbox
(length should be less than 500).
When I test the form, if length > 500, I get the appropriate error message
from the CustomValidation. When I replace the text in the textbox w/length <
500 chars and click submit, the form refreshes and the error message
disappears, but the form doesn't get submitted. I have to click "submit" a
second time and I get the expected result.
Can someone help me "submit" on first click please?
My code:
protected void cvTxtMessage_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (args.Value.Length < 500)
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
my HTML:
<asp:CustomValidator
ID="cvTxtMessage"
runat="server"
ControlToValidate="txtFeedbackBody"
Display="Dynamic"
ErrorMessage="* Message length exceeds 500 characters.
Please shorten your message."
OnServerValidate="cvTxtMessage_ServerValidate" />
Thanks!
Hoping someone can help me w/an annoying issue.
I'm using a CustomValidator to check the length of a value in a textbox
(length should be less than 500).
When I test the form, if length > 500, I get the appropriate error message
from the CustomValidation. When I replace the text in the textbox w/length <
500 chars and click submit, the form refreshes and the error message
disappears, but the form doesn't get submitted. I have to click "submit" a
second time and I get the expected result.
Can someone help me "submit" on first click please?
My code:
protected void cvTxtMessage_ServerValidate(object source,
ServerValidateEventArgs args)
{
if (args.Value.Length < 500)
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
my HTML:
<asp:CustomValidator
ID="cvTxtMessage"
runat="server"
ControlToValidate="txtFeedbackBody"
Display="Dynamic"
ErrorMessage="* Message length exceeds 500 characters.
Please shorten your message."
OnServerValidate="cvTxtMessage_ServerValidate" />
Thanks!