Google Chrome browser problem

Last post 08-07-2009 8:06 AM by dusha. 15 replies.

Sort Posts:

  • Google Chrome browser problem

    01-21-2009, 12:36 PM

    Hi

     I am calling a javascript function on "onBlur" function, its working fine in IE and Firefox, but its not firing on google chrome browser.

    please help me.

     Thanks

    Srinivas 

     

    Thanks
    Srini
  • Re: Google Chrome browser problem

    01-21-2009, 1:22 PM
    Answer
    • Star
      10,558 point Star
    • Danny117
    • Member since 12-16-2008, 2:30 PM
    • Royal Oak Michigan USA
    • Posts 1,837

    post some code so the group can try it out.

    Good Luck



  • Re: Google Chrome browser problem

    01-21-2009, 1:58 PM
    Answer

    This is the code, its firing in IE, Mozilla but it is not firing on Google chrome. 

    <input id="txtLastname" runat="server" type="text" maxlength="16" autocomplete = "off" tabindex="2" style="width: 127px" enableviewstate="false" onblur = "javascript:this.value=this.value.toUpperCase();"/>

    Thanks

    Srinivas 

     

    Thanks
    Srini
  • Re: Google Chrome browser problem

    01-21-2009, 2:22 PM
    Answer
    • All-Star
      24,306 point All-Star
    • budugu
    • Member since 01-12-2006, 2:15 PM
    • North Carolina
    • Posts 3,646

    I tried your code in Google chrome 1.0.154.43 ,and it worked fine. Which version you are using?

    You can also convert characters to uppercase like this... 

    <input id="txtLastname" runat="server" type="text" maxlength="16" autocomplete ="off" tabindex="2" style="width: 127px;text-transform:uppercase;" enableviewstate="false"  />
     
    Vijay Kodali || My Blog


    "Don't be afraid to be wrong; otherwise you'll never be right."
  • Re: Google Chrome browser problem

    01-21-2009, 2:57 PM
    Answer

    I am using Google Chrome 1.0.154.43

    Thanks
    Srini
  • Re: Google Chrome browser problem

    01-21-2009, 3:05 PM
    Answer

    I am calling this function on onBlur event

     

    function formatSSN()

    {

    var ssn = document.getElementById("txtSSN").value;if(ssn.length == 9)

    {

    document.getElementById(
    "txtSSN").value= ssn.substring(0, 3) +"-" + ssn.substring(3, 5) + "-" + ssn.substring(5, 9);

    }

    }

    Thanks
    Srini
  • Re: Google Chrome browser problem

    01-21-2009, 3:23 PM
    Answer
    • Star
      10,558 point Star
    • Danny117
    • Member since 12-16-2008, 2:30 PM
    • Royal Oak Michigan USA
    • Posts 1,837

    Can't duplicate problem.  Back to drawing board. 

    Worked on chrome version 1.0.154.43 no problem

    Worked on firefox version 3.0.5

    worked on IE7

     

     

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <!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">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
        <input id="txtLastname" runat="server" type="text"
        maxlength="16" autocomplete = "off" tabindex="2"
        style="width: 127px" enableviewstate="false"
        onblur = "javascript:this.value=this.value.toUpperCase();"/>
       
        </div>
        </form>
    </body>
    </html>

    Good Luck



  • Re: Google Chrome browser problem

    01-21-2009, 3:29 PM
    Answer
    • All-Star
      24,306 point All-Star
    • budugu
    • Member since 01-12-2006, 2:15 PM
    • North Carolina
    • Posts 3,646

    srinivasanugula:
    I am calling this function on onBlur event

    This one also workng in Chrome for me. What is your problem ? Are you getting any error?.. 

    <input id="txtSSN" runat="server" type="text" maxlength="16" autocomplete ="off" tabindex="2" style="width: 127px" enableviewstate="false" onblur ="formatSSN();"/>
     
    Vijay Kodali || My Blog


    "Don't be afraid to be wrong; otherwise you'll never be right."
  • Re: Google Chrome browser problem

    01-21-2009, 3:33 PM
    • All-Star
      20,624 point All-Star
    • A1ien51
    • Member since 05-06-2005, 6:46 PM
    • MD USA
    • Posts 3,788

     note when running JavaScript in event handlers you do not need javascript: so you can remove that.

    Eric

     

  • Re: Google Chrome browser problem

    01-23-2009, 3:14 PM
    Answer

    i checked with a simple page its working fine, but if add the asp.net validators to that input control, than its not triggaring the javascript.

     Please check with this and help me.

    <input id="txtLastname" runat="server" type="text" maxlength="16" autocomplete = "off" tabindex="2" style="width: 127px" onblur = "javascript:this.value=this.value.toUpperCase();"/><asp:RequiredFieldValidator ID="RfLastname" runat="server" ControlToValidate="txtLastname" Display="None" ErrorMessage="Last Name" SetFocusOnError="True" EnableViewState="False"></asp:RequiredFieldValidator><asp:RegularExpressionValidator ID="ReLastname" runat="server" ControlToValidate="txtLastname" Display="None" ErrorMessage="Last Name" ValidationExpression="^[a-zA-Z'-.\s]{1,13}$" EnableViewState="False"></asp:RegularExpressionValidator>

    Thanks

    srinivas

    Thanks
    Srini
  • Re: Google Chrome browser problem

    01-23-2009, 3:28 PM
    Answer
    • All-Star
      24,306 point All-Star
    • budugu
    • Member since 01-12-2006, 2:15 PM
    • North Carolina
    • Posts 3,646

    Yes, It seems to be Chrome has problem with "onbur" events and validators. But following code will work in all browsers.. 

    <input id="txtLastname" runat="server" type="text" maxlength="16" autocomplete = "off" tabindex="2" 
    style="width: 127px;text-transform:uppercase;" onblur = "javascript:this.value=this.value.toUpperCase();"/>
    <asp:RequiredFieldValidator ID="RfLastname" runat="server" ControlToValidate="txtLastname" 
    Display="None" ErrorMessage="Last Name" SetFocusOnError="True" 
    EnableViewState="False"></asp:RequiredFieldValidator>
    <asp:RegularExpressionValidator ID="ReLastname" runat="server" ControlToValidate="txtLastname" 
    Display="None" ErrorMessage="Last Name" ValidationExpression="^[a-zA-Z'-.\s]{1,13}$" EnableViewState="False">
    </asp:RegularExpressionValidator>
    
     
    Vijay Kodali || My Blog


    "Don't be afraid to be wrong; otherwise you'll never be right."
  • Re: Google Chrome browser problem

    01-23-2009, 3:37 PM
    Answer

    Thanks, its ok for converting to UpparCase letters, but i am calling a javascript function for formatting (999-99-9999) ssn.

    In this case what can i do, please help me.

    Note: (Here i am calling formatSSN() function in onblur event, it formats the no from 999999999 to 999-99-9999

     <input id="txtSSN" runat="server" type="text" maxlength="11" autocomplete = "off" tabindex="1" onblur = "formatSSN()"/>

    <asp:RequiredFieldValidator ID="RfSSN" runat="server" ControlToValidate="txtSSN" Display="None" ErrorMessage="Social Security Number" SetFocusOnError="True" EnableViewState="False"></asp:RequiredFieldValidator>

    <asp:RegularExpressionValidator ID="ReSSN" runat="server" ControlToValidate="txtSSN" Display="None" ErrorMessage="Social Security Number" ValidationExpression="\d{3}-\d{2}-\d{4}" EnableViewState="False"></asp:RegularExpressionValidator>

    Thanks

    Srinivas

    Thanks
    Srini
  • Re: Google Chrome browser problem

    01-23-2009, 3:55 PM
    • All-Star
      24,306 point All-Star
    • budugu
    • Member since 01-12-2006, 2:15 PM
    • North Carolina
    • Posts 3,646

    "On Blur" event is a bug with google chrome . So you can not use that. You may want do it in "onKeyUp" event. Which will work for all browsers.. 

      <input id="txtLastname" runat="server" type="text" maxlength="16" autocomplete = "off" tabindex="2" 
          style="width: 127px" onKeyUp= "formatSSN();"/>
     
    Vijay Kodali || My Blog


    "Don't be afraid to be wrong; otherwise you'll never be right."
  • Re: Google Chrome browser problem

    01-23-2009, 4:06 PM
    Answer

    Its working fine..thanks a lot..

    Thanks
    Srini
  • Re: Google Chrome browser problem

    01-24-2009, 10:09 PM
    Answer
    • All-Star
      24,306 point All-Star
    • budugu
    • Member since 01-12-2006, 2:15 PM
    • North Carolina
    • Posts 3,646

    srinivasanugula:
    Its working fine..thanks a lot..

    Glad it helped!!

    Actually it's not a bug with "onblur" event. Chrome has some problems with RequiredField validator's SetFocusOnError property.

    I made a blog post on this bug.

    Vijay Kodali || My Blog


    "Don't be afraid to be wrong; otherwise you'll never be right."
Page 1 of 2 (16 items) 1 2 Next >