5 Answers, 1 is accepted
0
Cori
Top achievements
Rank 2
answered on 03 Sep 2010, 02:27 PM
Hello Jon,
That is correct, validation only fires if the control posts back, at least in the case when you use a CustomValidator control to do validation. Also, I don't quite understand your issue, do you want validation to occur on the combobox when a different item is selected or do you want validation on the rest of the form to be validated based on the selection made in the combobox. If you could expand on what you want to do or show us a simple version of your page.
I hope that helps.
That is correct, validation only fires if the control posts back, at least in the case when you use a CustomValidator control to do validation. Also, I don't quite understand your issue, do you want validation to occur on the combobox when a different item is selected or do you want validation on the rest of the form to be validated based on the selection made in the combobox. If you could expand on what you want to do or show us a simple version of your page.
I hope that helps.
0
Jon
Top achievements
Rank 1
answered on 03 Sep 2010, 02:31 PM
The problem is I have a huge form.. and I dont' wanto postback to validate a the combobox... because on postback.. I change the current control focus and do other stuff.... I'm not a javascript guy and don't know how to write client side validation code (Convert my custom validator regularexpressions to JS)
thanks
thanks
0
Hi Jon,
What is the expression that you're using. Perhaps we can help you with the conversion.
Sincerely yours,
Tsvetomir Tsonev
the Telerik team
What is the expression that you're using. Perhaps we can help you with the conversion.
Sincerely yours,
Tsvetomir Tsonev
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0
Jon
Top achievements
Rank 1
answered on 07 Sep 2010, 05:37 PM
Thanks...
<asp:RegularExpressionValidator ID="valEMAIL" runat="server"
ControlToValidate="txtEMAIL" ErrorMessage="* Improperly formatted Email address"
Font-Bold="False" ForeColor="Red" SetFocusOnError="True"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
Display="Dynamic"></asp:RegularExpressionValidator>
0
Hello Jon,
In fact ASP.NET validators can be fired at client-side with the ValidatorValidate method.
You can handle OnClientBlur RadComboBox event (and optionally OnClientSelectedIndexChanged event) and fire the RegularExpressionValidator in this manner:
Additionally – please change the regular expression that you use from:
to:
I prepared for you a sample page in order to illustrate this approach – please find it attached.
Best wishes,
Kalina
the Telerik team
In fact ASP.NET validators can be fired at client-side with the ValidatorValidate method.
You can handle OnClientBlur RadComboBox event (and optionally OnClientSelectedIndexChanged event) and fire the RegularExpressionValidator in this manner:
function
OnClientBlurHandler(sender, eventArgs) {
var
regularExpressionValidator = document.getElementById(
'<%= valEMAIL.ClientID %>'
);
ValidatorValidate(regularExpressionValidator);
var
requiredFieldValidator = document.getElementById(
'<%= RequiredFieldValidator1.ClientID %>'
);
ValidatorValidate(requiredFieldValidator);
}
Additionally – please change the regular expression that you use from:
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
ValidationExpression="\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
I prepared for you a sample page in order to illustrate this approach – please find it attached.
Best wishes,
Kalina
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items