View Full Version : [CLOSED] How to deal with multiple validation groups?

Nov 18, 2015, 8:56 PM
how should I set up my page to be able to deal with multiple validation groups?

This is a very simple example of two fields with different validation groups. I need to validate only one group, before saving the form. I know, there is a Buttons collection in the FormPanel, and tried to use FormBind property along with ValidationGroup, but the later seems to be ignored.

<%@ Page Language="C#" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
if (!X.IsAjaxRequest)

private void Save(object sender, DirectEventArgs e)
throw new NotImplementedException();


<!DOCTYPE html>

<head runat="server">

<script type="text/javascript">

<ext:ResourceManager runat="server" />

<ext:FormPanel ID="FormPanel1" runat="server" Frame="True" MinHeight="200" Border="False" Layout="Form" BodyPadding="10" ButtonAlign="Left" AutoScroll="True" >
<ext:TextField runat="server" ID="tf1" FieldLabel="Field1" ValidationGroup="vg1" AllowBlank="False"></ext:TextField>
<ext:TextField runat="server" ID="tf2" FieldLabel="Field2" ValidationGroup="vg2" AllowBlank="False"></ext:TextField>
<ext:Panel runat="server">
<ext:Button runat="server" ID="btSave" Text="Validate only vg1">
<Click OnEvent="Save" Before="return #{FormPanel}.validate();"></Click>

So I tried to validate the fields manually, like this:

NS.getInvalidFields = function(form, validationGroup) {
var invalidFields = [];
form.getForm().getFields().filterBy(function (field) {
if (field.validate()) return;
return invalidFields;

But I couldn't find the ValidationGroup property of the field.

Please let me know, what is the preferred approach to this problem.

Thank you!

Nov 19, 2015, 1:21 PM
Hi @exe,

ValidationGroup is a native ASP.NET property and used for server side validation. Ext.NET doesn't use it for client side validation.

So I tried to validate the fields manually

Yes, it is a way to go.

But I couldn't find the ValidationGroup property of the field.

ValidationGroup is not rendered to client (since it is used by ASP.NET for server side validation).

Please use CustomConfig.

<ext:TextField ...>
<ext:ConfigItem Name="validationGroup" Value="vg1" Mode="Value" />

Nov 20, 2015, 5:38 PM
Ok, thanks!