EnableEventValidation=false causes unexpected behaviour

  1. #1

    EnableEventValidation=false causes unexpected behaviour

    Please consider the code below in the recently released Coolite 0.8 framework (works perfectly in Coolite 0.7).
    When EnableEventValidation is set to 'false', clicking on the button will make the TextField disappear after the AsyncPostBack.

    When its set to true, nothing strange occur.

    <%@ Page Language="C#"  EnableEventValidation="false" ValidateRequest="false" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <body style="overflow: auto;">
        <form id="form1" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager2">
        <ext:ScriptManager ID="ScriptManager1" runat="server">
        <ext:ViewPort ID="ViewPort1" runat="server">
                <ext:BorderLayout ID="BorderLayout1" runat="server">
                        <ext:Panel runat="server">
                                    <asp:UpdatePanel runat="server" ID="updMain">
                                            <ext:TextField ID="txtSearchOld" runat="server" Width="270px" CtCls="txtSearch" EmptyText="empty text"
                                            <asp:Button ID="Button1" runat="server" />
                        <ext:Panel runat="server">
  2. #2

    RE: EnableEventValidation=false causes unexpected behaviour

    I was able to reproduce the issue, although have not been able to find a fix. The controls lifecycle is functioning differently with EnableEventValidation="false" and we'll have to spend some more time debugging.

    It's generally not recommended to set EnableEventValidation="false", so I was just wondering what scenario requires this setting?

    Geoffrey McGill
    Founder & CEO
  3. #3

    RE: EnableEventValidation=false causes unexpected behaviour

    The most common scenario i've experienced so far is the one when a user is typing the charachter "<" in a TextBox, when EnableEventValidation=true.

    This will result in "Invalid Postback or Callback argument"

    see more here: http://niravbhattsai.blogspot.com/20...-argument.html

    as i said before - everything was ok until Coolite 0.8... what changed?

  4. #4

    RE: EnableEventValidation=false causes unexpected behaviour

    Hi omeriko9,

    I solved adding Vtype to the textbox control. That occured also with the 0.7 release.
    It happens with charachters "<" ">".

    If it is valid in your scenario, use the code below.
    In my case end user can't insert these characters.

    <ext:TextField ID="TE_Text" Vtype="apici" AllowBlank="false" 
        BlankText="required field" FieldLabel="Label" runat="server" />
    JS code
    Ext.form.VTypes['apiciVal'] = /^[^<>]*$/;
    Ext.form.VTypes['apiciMask'] = /^[^<>]*$/;
    Ext.form.VTypes['apiciText'] = 'invalid charachters';
    Ext.form.VTypes['apici'] = function(v) {
        return Ext.form.VTypes['apiciVal'].test(v);
    Hope it helps

  5. #5

    RE: EnableEventValidation=false causes unexpected behaviour

    Hi methode,

    thank you for your solution, i will definitely use it.

    My problem is not how to prevent the user from using any "<" in the TextBox (Actually, i would like to let him user those chars because he might post some xml).

    The two main reasons i need to use EnableEventValidation=false are heavy manipulation of elements using client script, and the use of __doPostBack().

  6. #6

    RE: EnableEventValidation=false causes unexpected behaviour

    Another common scenario for using EnableEventValidation=false is implementation of row select in a asp:GridView with a click on the row, following this article :


    and then hiding the "select" button.
  7. #7

    RE: EnableEventValidation=false causes unexpected behaviour

    Another issue we've encountered when EnableEventValidation = false is that popup windows are not shown.

    Here is a simple example you can use to test this scenario:


    <asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional">
        <asp:linkbutton id="lnkActions" runat="server">Actions</asp:linkbutton>
    <cool:Window ID="ActionsWindow" runat="server" Height="480px" Width="700px">
    file: aspx.cs

    override protected void OnInit(EventArgs e)
        lnkActions.Click += new EventHandler(lnkActions_Click);
    void lnkActions_Click(object sender, EventArgs e)

  8. #8

    RE: EnableEventValidation=false causes unexpected behaviour

    Hi guys,

    anything new here, good or bad?

Similar Threads

  1. BADRESPONSE: Unexpected token { on calendar control
    By Felixkirathe in forum 2.x Help
    Replies: 1
    Last Post: Apr 17, 2012, 4:07 PM
  2. Replies: 3
    Last Post: Apr 16, 2012, 1:56 PM
  3. Replies: 3
    Last Post: Mar 10, 2011, 2:05 PM
  4. [CLOSED] Load failed: Unexpected token <
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 02, 2010, 5:58 PM
  5. FormPanel validation unexpected firing
    By RPIRES in forum 1.x Help
    Replies: 2
    Last Post: Jun 11, 2010, 9:36 PM

Posting Permissions