0

Is it possible to get and control a validation group using javascript? I was able to validate ASPxHtmlEditor if empty or not, but i need to control the validation group. I'm using .net 2.0.

EDITS [04202011]

I need to make ASPxHtmlEditor a required field. I'm using an older version (10.1.6.0) of DevEx (can't update right now), but there is no validation settings for it. I used javascript to validate the editor

function validateEmptyEditor(html)
{
   html = html.replace(' ', '');
   html = html.replace('<br />', '');

   if (html.length < 1)
   {
      return false;
   }
   else
   {
      return true;
   }
}

I invoked the function in LostFocus of ASPxHtmlEditor.ClientSideEvents and is working properly. But my page uses validation group for saving. So I need to manipulate validation group when validateEmptyEditor is invoked. Is it possible to control validation group?

KaeL
  • 3,639
  • 2
  • 28
  • 56

1 Answers1

1

If I understand your task properly, you would like to know, whether the controls residing in the ValidationGroup are passing validation or not. If so, this can be done using the following js code:

var isValid = ASPxClientEdit.ValidateGroup("GroupName");

Does this help?

DevExpress Team
  • 11,338
  • 2
  • 24
  • 23
  • Hi, unfortunately `ASPxHtmlEditor` under the version stated above, does not support validation settings, so it will not be included when evaluating the validation group. Is it possible to assign value to the validation group to make it false? – KaeL Apr 20 '11 at 09:21
  • But this is a helpful function, i could use this in some of my pages. Thanks :D – KaeL Apr 20 '11 at 09:27
  • 1
    It is impossible to set the validation group result. However, before posting data to the server, you can check both the HtmlEditor's value and ValidationGroup result. If both are correct, you should allow to post the request to the server. Otherwise - forbid. – DevExpress Team Apr 20 '11 at 10:14
  • Yeah I forgot that. I can use `e.ProcessOnServer = false;` right? – KaeL Apr 20 '11 at 10:18