[FIXED] TextBox Regex property

  1. #1

    [FIXED] TextBox Regex property



    Hi,
    I'm trying to use regular expression validation with the Textbox, but i notice that

    <cool:TextBox Runat="server" AllowBlank="false" Regex="/^[a-zA-Z_]+$/"></cool:TextBox>
    is rendered as:

    this.m_c_ctl00=new Ext.form.TextField({
        allowBlank:false,
        applyTo:"m_c_ctl00_TextBox",
        regex:"/^[a-zA-Z_]+$/",
        id:"m_c_ctl00"
    });}
    With the double-quotes that are placed around the regex property value, ExtJs throws a Javascript error.
    When I manually remove the double quotes, the validation works fine.

    Am I declaring regex validation the right way? Or could this be a bug?

    Greetings,
    Martijn
  2. #2

    RE: [FIXED] TextBox Regex property

    Hi Martijn,

    Thanks for pointing out this Regex bug. At some point we changed the way the Json serializer was handling Regex property types and this caused a bug.

    I've found the problem code, fixed and tested to ensure it's now working properly. The new code will be included with the next release (v0.5).

    Until the 0.5 release, I would recommend removing the regular expression from the "Regex" property and add manually during the <Render> event.

    Example

    <cool:TextBox ID="TextBox1" Runat="server" AllowBlank="false">
        <ClientEvents>
            <Render Handler="function(el){el.regex = /^[a-zA-Z_]+$/;}" />
        </ClientEvents>
    </cool:TextBox>
    For reference, the syntax for the above control tag will be changing slightly with the version 0.5 release.

    Example

    <ext:TextBox ID="TextBox1" Runat="server" AllowBlank="false">
        <Listeners>
            <Render Handler="function(el){el.regex = /^[a-zA-Z_]+$/;}" />
        </Listeners>
    </ext:TextBox>
    Hope this helps.
    Geoffrey McGill
    Founder

Similar Threads

  1. Replies: 1
    Last Post: Jan 02, 2012, 5:13 PM
  2. [FIXED] DisabledDate regex
    By wazige in forum Bugs
    Replies: 5
    Last Post: Mar 04, 2011, 2:29 PM
  3. setting the RegEx property dynamicly!?!
    By bassel in forum 1.x Help
    Replies: 1
    Last Post: Jun 11, 2010, 12:07 PM
  4. Replies: 4
    Last Post: Aug 10, 2009, 5:23 AM
  5. Replies: 1
    Last Post: Dec 25, 2008, 6:32 AM

Posting Permissions