View Full Version : [CLOSED] Validation

Jun 15, 2012, 3:47 PM
I have a grid with a combo editor and a RowEditing plugin. The combo allows type-ahead. Now I am trying to validate my entry. When I just type in some letters and tab without actually selecting anything from the drop-down, the new value is that text, and not the value associated in the store (which, since it doesn't exist should be null or 0 - I would think). Also, because I am in a grid and using an "Add" button, I have inserted to the grid and have to use a cancel edit function to remove that insert if the row editor is cancelled. So, my question is how do I validate my combo and stop any other eventes without raising the cancel event on my RowEditing plug-in?

Jun 15, 2012, 5:55 PM

I would try to use the ComboBox Validator.


<%@ 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)
Store store = this.ComboBox1.GetStore();
store.DataSource = new object[]
new object[] { "1", "item1" },
new object[] { "2", "item2" },
new object[] { "3", "item3" }


<head runat="server">
<title>Ext.NET v2 Example</title>

<script type="text/javascript">
var myValidator = function (value) {
var valid = true;

if (value !== "item2") {
valid = "Must be 'item2'";

return valid;
<form runat="server">
<ext:ResourceManager runat="server" />
<ext:ComboBox ID="ComboBox1" runat="server">
<Validator Fn="myValidator" />
<ext:Store runat="server">
<ext:Model runat="server">
<ext:ModelField Name="value" />
<ext:ModelField Name="text" />
<ext:ArrayReader />