This is a migrated thread and some comments may be shown as answers.

[Solved] Validator Issues

2 Answers 146 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Felipe Saldana
Top achievements
Rank 1
Felipe Saldana asked on 24 Mar 2009, 10:09 PM
I am running into various validator - validation issues on my pages and was wondering if anybody has ever ran across this problem.

Example: I have a custom UserControl placed in a MultiView that is placed in a RadAjaxPanel.  The UserControl is made up of first name, last name, address, city state fields with most fields having a RequiredFieldValidator.  Without filling out the control I click the "save customer" button.  The RequiredFieldValidator is ignored and the page post back.

Example: I have the following code.  I want the RadComboBox the post back and it does...but the ClientValidationFunction is firing while I have the CausesValidation=false

<telerik:RadComboBox ID="ddl" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddl_SelectedIndexChanged" TabIndex="1" Width="350px" CausesValidation=false></telerik:RadComboBox> 
<asp:CustomValidator ID="valReqSelected" runat="server" ClientValidationFunction="checkSelection" Text="" Display="Static" ErrorMessage="Please select." EnableClientScript="true" ValidateEmptyText="true" ControlToValidate="ddl"  ValidationGroup="Save"></asp:CustomValidator> 
 

Any help would be appreciated

2 Answers, 1 is accepted

Sort by
0
Felipe Saldana
Top achievements
Rank 1
answered on 27 Mar 2009, 12:49 AM
Part of the problem was in the onClientClick event I was using a "return function_name();" instead of "function_name();"

I still had a problem with the CustomValidators though.  

I created a javascript function to manually validate all the controls.



0
Accepted
Pavlina
Telerik team
answered on 30 Mar 2009, 10:18 AM
Hi Felipe,

I suggest that you perform the validation server-side, then handle the ServerValidate event of the CustomValidator in code-behind.
Additionally you can use server validation by setting the EnableClientScripts property of the validators to false.

More information about RadAjax limitation for ASP Standard Validators is available in the following help topic.

I hope this helps.

Greetings,
Pavlina
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Ajax
Asked by
Felipe Saldana
Top achievements
Rank 1
Answers by
Felipe Saldana
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or