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

Validation

1 Answer 57 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Jon
Top achievements
Rank 1
Jon asked on 11 Feb 2011, 02:15 PM
Hi,

I have a custom validator for my upload control that checks to see if a there is a file set and b if the file type is correct.  This works fine in the main.

The problem that I am having is that if you click on the upload button for the form before a file is selected the validation fires and shows that the file is missing, BUT when you then select a file the validator doesn't fire again to clear the error message.  The form can be submitted thus triggering the validation though.

Please could functionality be added to the control so that validation can be triggered after the select button has been pressed?  At the moment many telerik editor controls seem to be like this while others revalidate on leaving the field.  Eg Combo box.

Regards,

Jon

1 Answer, 1 is accepted

Sort by
0
Cori
Top achievements
Rank 2
answered on 15 Feb 2011, 02:07 PM
Hello Jon,

The CustomValidator control never fires automatically unless you set the ControlToValidate property and set it to validate for empty text. It won't fire its ClientValidationFunction until a button is pressed to raise that event. If you want the RadUpload control to call the CustomValidator's Validate event, you handle the RadUpload's OnClientFileSelected client-side event and tell the CustomValidator to validate. Like so:

function OnClientFileSelected(sender, args){
    ValidatorValidate($get("<%=CustomValidator1.ClientID %>"));
}

I hope that helps.
Tags
Upload (Obsolete)
Asked by
Jon
Top achievements
Rank 1
Answers by
Cori
Top achievements
Rank 2
Share this question
or