Monday, July 21, 2008

FCKEditor and RequiredFieldValidator: The Second Submit Issue

If you've noticed, the FCKEditor doesn't work too well with the RequiredFieldValidator. The RequiredFieldValidator reports invalid data indicating that no value has been provided for the FCKEditor. However, when you cause a postback again to submit the value, all is well.

This can be pretty annoying since you would have to write a custom validator, but for a quick fix you can just disable client-side validation on the RequiredFieldValidator by setting the EnableClientScript to false. Make sure the submit button or whatever control you are using has a handler that checks for Page.IsValid before you do anything... when you disable the client-side code, all the server-side code for the validators do is set the IsValid property of the page are let your event handlers execute normally.

No comments: