Welcome Guest Search | Active Topics | Sign In | Register

Validating input of the HTMLEditor Options
HT
Posted: Sunday, December 7, 2008 2:28:56 PM
Rank: Advanced Member
Groups: Member

Joined: 3/18/2008
Posts: 41
Hi.

I'm trying to use the Editor together with a CustomValidator (the CustomValidator's attribute ClientValidationFunction="ValidateContent", see the javascript function below). I want to check if the user has written some content into the editor before he submits the forms.

The validation works as long as the Editor is in Design Mode when the submit button is clicked. But when the editor in in HTML Mode or Preview Mode when the submit button is clicked, the form submits no matter what the content is in the Editor. It seems like the validator will not work when the Editor is in HTML Mode or Preview Mode: When the editor is in one of these two modes, not even the line alert(content.getHtml()); is called.

My javascript code running with the CustomValidator:

Code: JavaScript
function ValidateContent(oSrc, args)    
{ 
  var content = eo_GetObject('" + txtContent.ClientID + @"');
  alert(content.getHtml());  // just to check if the function is called
  if (content.getHtml().trim() == '' || content.getHtml().trim() == '<p> </p>')
  {
    args.IsValid = false;
  }
  else
  {
    args.IsValid = true;
  }
}


Is this a bug, or am I doing something wrong when I want to validate that the Editor has some content?

What is the best way to validate the input of the Editor no matter in which mode the Editor is when the form is submitted?

HT
eo_support
Posted: Monday, December 8, 2008 7:41:19 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi,

This appears to be a bug. We will get it fixed as soon as possible.

Thanks!
eo_support
Posted: Friday, December 19, 2008 4:05:23 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
This issue has been fixed in build 2008.0.55.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.