[CLOSED] Vtype email restricting hyphen...

  1. #1

    [CLOSED] Vtype email restricting hyphen...

    Hi,

    I am using Coolite version 0.8.1.37660. While using text field where vtype is "email" for email address validation I am seeing an issue, it does not allow hyphen in the email address. Please see the following code:


    <ext:TextField ID="txtEmail" runat="server" FieldLabel="<% $resources:forms, Lbl_Email %>"
                            Vtype="email" ValidationEvent="fake" BlankText="<% $resources:forms, Error_Msg_Email_Required %>" LabelSeparator="" 
                            AllowBlank="false" MsgTarget="under"/>
    While googling I found that the version of coolite that I am using has very restrictive email regular expression. So my question is how I can make it work with version(0.8.1.37660) that I am using. Is there is a way that I can add my own regular exression for email validation inside coolite. Let me know please if there is any workaround.

    Thanks!

  2. #2

    RE: [CLOSED] Vtype email restricting hyphen...

    Hi,

    Try to add the following script to the page
        <ext:ScriptContainer runat="server" />
        <script type="text/javascript">
            Ext.apply(Ext.form.VTypes, {
                email:  function(v) {
                    return /^(\w+)([-+.][\w]+)*@(\w[-\w]*\.){1,5}([A-Za-z]){2,4}$/.test(v);
                }
            });
        </script>
    Please note that that script block should add after the ScriptContainer in the head section
  3. #3

    RE: [CLOSED] Vtype email restricting hyphen...

    The following should also work if you want to change the validation logic on a per component instance basis.

    Vladimirs solution above will override the existing logic at a Page level.

    Example

    <ext:TextField 
        runat="server" 
        Regex="^(\w+)([-+.][\w]+)*@(\w[-\w]*\.){1,5}([A-Za-z]){2,4}$" 
        RegexText="Validation Error" 
        />
    Hope this helps.

    Geoffrey McGill
    Founder

Similar Threads

  1. nullable TextField with Vtype of email
    By javadzarrin in forum 1.x Help
    Replies: 1
    Last Post: Sep 06, 2010, 7:40 PM
  2. [CLOSED] HTMLEditor and print, copy and email functions
    By yobnet in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: May 21, 2010, 10:04 AM
  3. [CLOSED] Vtype problem
    By majestic in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 12, 2010, 9:47 AM
  4. eMail/Calendar
    By mmiocev in forum Open Discussions
    Replies: 0
    Last Post: Dec 01, 2009, 9:24 AM
  5. [CLOSED] Restricting a window control.
    By prashobkumar in forum 1.x Help
    Replies: 3
    Last Post: Dec 12, 2008, 7:27 AM

Posting Permissions