Script runs good in IE9 but not in IE8

  1. #1

    Script runs good in IE9 but not in IE8

    I use ext.net controls in ASP.NET WebForms application.
    It works fine in Chrome 13-14, Opera 11, FF 6, but not in IE8.
    It throws JavaScript errors such as:

    Invalid argument

    And:

    BaseMainContent_MainContent_ctlContent_txtFax_txtC ountryCode' is undefined

    If it's enough information, how can I resolve it?

    A code example
    <div>
        <ext:TextField runat="server" MsgTarget="Side" ID="LoginTxt" IsRemoteValidation="true">
            <RemoteValidation OnValidation="ValidateLogin" ShowBusy="true" />
        </ext:TextField>
    </div>
    <br />
    <div>
        <div>
            <ext:TextField ID="PasswordTxt1" runat="server" InputType="Password"></ext:TextField>
            <ext:TextField runat="server" ID="PasswordTxt2" Vtype="password" FieldLabel="Повторите пароль"
                InputType="Password" MsgTarget="Side" IsRemoteValidation="true">
                <RemoteValidation OnValidation="ValidatePasswords" ShowBusy="true" />
            </ext:TextField>
        </div>
    </div>
    <div>
        <ext:ComboBox Width="200"  runat="server" ID="LocaleCmb" Editable="false"
            SelectedIndex="0">
            <Items>
                <ext:ListItem Text="Русский" Value="ru-RU" />
                <ext:ListItem Text="English" Value="en-US" />
            </Items>
        </ext:ComboBox>
    </div>
    <div>
        <ext:TextField runat="server"  ID="LastNameTxt" />
    </div>
    
    <ext:TextField runat="server" ID="EmailTxt" MsgTarget="Side" FieldLabel="Email" Vtype="email"
        IsRemoteValidation="true">
        <RemoteValidation OnValidation="ValidateEmail" ShowBusy="true" />
    </ext:TextField>
    <div>
        <uc:PhoneTextBox2 ID="PhoneUc" runat="server"/>
    </div>
    
    <div>
        <uc:PhoneTextBox2 ID="FaxUc" runat="server"  />
    </div>
    <br />
    
    <div>
        <uc:Address2 Title="Адрес" ID="AddressUc" CoordinatesVisible="false" runat="server" />
    </div>
    <div>
    
        <div id="RecaptchaDiv" runat="server" class="x-form-invalid-icon" style="left: 350px; top: 0px;
            position: relative; visibility: visible;">
        </div>
        <recaptcha:RecaptchaControl ID="Recaptcha" runat="server" />
    </div>
    
    
    <ext:Button runat="server" ID="SubmitTxt" Text="Register me">
        <DirectEvents>
            <Click OnEvent="SubmitBtnClick">
                <EventMask ShowMask="true"></EventMask>
            </Click>
        </DirectEvents>
    </ext:Button>
    <uc:BackLinkButton ID="lnkPreviousPage" runat="server" />
    In this case the error is
    SCRIPT87: Invalid argument. ext.axd?v=21945, line 7 character 31283

    A screenshot Click image for larger version. 

Name:	Untitled.jpg 
Views:	152 
Size:	104.4 KB 
ID:	3259
  2. #2
    Conversation regarding this issue and ultimately the solution will be posted on the following StackOverflow thread, see

    http://stackoverflow.com/questions/7566855/ext-net-script-error-in-ie8-that-doesnt-occur-in-other-browsers-including-ie9

    Geoffrey McGill
    Founder
  3. #3
    geoffrey.mcgill, I've found the first error. It occurs only in IE8 (maybe in IE7, 6... I don't know), but not in IE9, FF 6, Chrome 13, Opera 11.
    As I've said I have a user control named PhoneTextBox2

    public partial class PhoneTextBox2 : System.Web.UI.UserControl {
    
        public bool EnableEmptyValues { get; set; }
        public string Title { get; set; }
        protected void Page_Init(object sender, EventArgs e) {
            txtCountryCode.AllowBlank = EnableEmptyValues;
            txtCityCode.AllowBlank = EnableEmptyValues;
            txtMainPhoneNumber.AllowBlank = EnableEmptyValues;
    
        }
    
        protected void Page_Load(object sender, EventArgs e) {
            if (!IsPostBack) {
                eCompositeField.FieldLabel = Title;
                if (!string.IsNullOrWhiteSpace(DataSource)) {
    
                    string[] phoneNumberArray = DataSource.Split('-');
                    if (phoneNumberArray.Length >= _standartDimension) {
                        txtCountryCode.Text = phoneNumberArray[0];
                        if (txtCountryCode.Text[0] == _plus) {
                            txtCountryCode.Text = txtCountryCode.Text.Remove(0, 1);
                        }
                        txtCityCode.Text = phoneNumberArray[1];
                        txtMainPhoneNumber.Text = phoneNumberArray[2];
                        if (phoneNumberArray.Length >= _extraDimension) {
                            txtExtraPhoneNumber.Text = phoneNumberArray[3];
                        }
                    }
                }
            }
        }
    
    
    
        public string DataSource { get; set; }
    
    
        private const string _phoneNumberMask = "+{0}-{1}-{2}-{3}";
        private const char _plus = '+';
        private const int _standartDimension = 3;
        private const int _extraDimension = 4;
    
    
        public string Number {
            get {
                if (!string.IsNullOrWhiteSpace(txtCountryCode.Text) &&
                    !string.IsNullOrWhiteSpace(txtCityCode.Text) &&
                    !string.IsNullOrWhiteSpace(txtMainPhoneNumber.Text)) {
    
    
                    if (!string.IsNullOrWhiteSpace(txtExtraPhoneNumber.Text))
                        return string.Format(_phoneNumberMask, txtCountryCode.Text, txtCityCode.Text, txtMainPhoneNumber.Text, txtExtraPhoneNumber.Text);
    
                    string phoneNumber = string.Format(_phoneNumberMask, txtCountryCode.Text, txtCityCode.Text, txtMainPhoneNumber.Text, string.Empty);
                    return phoneNumber.Remove(phoneNumber.Length - 1);
    
                }
                return string.Empty;
            }
        }
    
     public bool IsEmpty {
            get {
                return (string.IsNullOrWhiteSpace(txtCountryCode.Text) &&
                        string.IsNullOrWhiteSpace(txtCityCode.Text) &&
                        string.IsNullOrWhiteSpace(txtMainPhoneNumber.Text) &&
                        string.IsNullOrWhiteSpace(txtMainPhoneNumber.Text));
            }
        }
    
        /// <summary>
        /// Validate 
        /// </summary>
        public void Validate() {
            if (EnableEmptyValues) {
                if (!IsEmpty && Number == string.Empty)
                    MarkInvalid();
                else
                    MarkValid();
            }
    
            else {
    
                if (IsEmpty)
                    MarkInvalid();
                else {
    
                    if (Number == string.Empty)
                        MarkInvalid();
                    else
                        MarkValid();
                }
            }
        }
    
        private const string InvalidFormatNumberMessage = "InvalidFormatNumberMessage";
        private const string EmptyNumberMessage = "EmptyNumberMessage";
    
    
        private const string InvalidCls = "invalidPhoneBox";
        public void MarkInvalid(string msg = null) {
           // eCompositeField.AddLabelCls(InvalidCls);
            txtCountryCode.MarkInvalid(msg);
            txtCityCode.MarkInvalid(msg);
            txtMainPhoneNumber.MarkInvalid(msg);
            txtExtraPhoneNumber.MarkInvalid(msg);
    
        }
    
        public void MarkValid() {
            //eCompositeField.RemoveLabelCls(InvalidCls);
    
            //eCompositeField.MarkAsValid();
            txtCountryCode.MarkAsValid();
            txtCityCode.MarkAsValid();
            txtMainPhoneNumber.MarkAsValid();
            txtExtraPhoneNumber.MarkAsValid();
        }
    
    
        public const string InvalidCheckBoxCssStyle = "border-color:#C30; background:  url('/extjs/resources/images/default/grid/invalid_line-gif/ext.axd') repeat-x scroll center bottom white; width: 40px !important;";
        public const string ValidCheckBoxCssStyle = "border-color:#000; background: none repeat scroll 0 0 transparent;";
    
    }
    aspx
    <style>
        .invalidPhoneBox
        {
            border-color: #C30;
            background: url('/extjs/resources/images/default/grid/invalid_line-gif/ext.axd') repeat-x scroll center bottom white;
        }
    </style>
    <ext:CompositeField runat="server" ID="eCompositeField" CombineErrors="false" AutoWidth="true"
        MsgTarget="Title">
        <Items>
            <ext:DisplayField runat="server" Text="(" />
            <ext:NumberField ID="txtCountryCode" Width="29" AllowNegative="false" AllowDecimals="false"
                MaxLength="3" runat="server" />
            <ext:DisplayField runat="server" Text=")" />
            <ext:NumberField runat="server" ID="txtCityCode" Width="58" AllowNegative="false" AllowDecimals="false"
                MaxLength="7" />
            <ext:TextField runat="server" ID="txtMainPhoneNumber" Width="60" MaxLength="7" AllowNegative="false"
                AllowDecimals="false" />
            <ext:TextField runat="server" ID="txtExtraPhoneNumber" Width="44" AllowBlank="false" MaxLength="5"
                AllowNegative="false" AllowDecimals="false" MsgTarget="Side" />
        </Items>
    </ext:CompositeField>
    using
    <uc:PhoneTextBox2 runat="server" Title="TitleTitleTitleTitle" />
    The error (the first error I've found, there are others errors I didn't found) "Invalid Argument" occurs if I set FieldLabel property for CompositeField.

    If set the Title (FieldLabel) by any different way
    <ext:CompositeField runat="server" ID="eCompositeField" CombineErrors="false" AutoWidth="true" MsgTarget="Title" FieldLabel="TitleTitleTitle">
    or int the codeBehind
    eCompositeField.FieldLabel = Title;
    that error occurs too.
    But if I don't set the Title this error doesn't occur.
    Last edited by AlexMaslakov; Sep 29, 2011 at 7:04 AM.

Similar Threads

  1. Replies: 0
    Last Post: Jul 09, 2012, 4:59 PM
  2. Ext.Net+ASP WebForm Big project small DLL good??
    By Martin.Vecchione in forum Open Discussions
    Replies: 3
    Last Post: Apr 05, 2012, 3:40 PM
  3. Desktop : Good practice
    By Yannis in forum 1.x Help
    Replies: 5
    Last Post: Mar 30, 2012, 10:32 AM
  4. Replies: 0
    Last Post: Jul 11, 2010, 10:24 AM
  5. DatePicker doesn't look good in tab
    By echo in forum 1.x Help
    Replies: 2
    Last Post: Jun 29, 2009, 6:55 AM

Posting Permissions