Problem in MaskedEditExtender with javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QWJoaQ==?=

    #1

    Problem in MaskedEditExtender with javascript

    Hi All,

    i have 3 textboxes for area Code,phone number and Extention and each have
    MaskedEditExten der associated with it.

    i want that when the length of first text box reaches it's maxlength , focus
    will be set to next textbox automatically, means i want auto tabbed fields.
    for which i created java script function and associated it with OnKeyDown
    and OnKeyUp event of TextBox. but it's not working and when i remove the
    MaskedEditExten der it workes fine, Can anyone please guide me.


    heare is my aspx code(here i am showing only 1 textbox but i have 3 textbox):-

    <asp:TextBox ID="txtAreaCode " runat="server" Width="25px" MaxLength="3"
    size="4" ></asp:TextBox>
    <AjaxToolKit:Ma skedEditExtende r ID="meeAreaCode " runat="server"
    TargetControlID ="txtAreaCod e"
    AutoComplete="f alse" Mask="999" MaskType="None"
    InputDirection= "LeftToRigh t"
    ClearMaskOnLost Focus="False" PromptCharacter =" "
    OnFocusCssClass ="MaskedEditFoc usNegative"
    OnInvalidCssCla ss="MaskedEditF ocusNegative">


    event association:-

    String areaCodeDown = "javascript:Tab Next(this,'down ', " +
    this.txtAreaCod e.MaxLength + ",)";
    String areaCodeUp = "javascript:Tab Next(this,'up', " +
    this.txtAreaCod e.MaxLength + ",'" + this.txtNumber. ClientID + "')";

    this.txtAreaCod e.Attributes["OnKeyDown"] = areaCodeDown;
    this.txtAreaCod e.Attributes["OnKeyUp"] = areaCodeUp;

    Javascript function :-
    var phone_field_len gth=0;
    function TabNext(obj,eve nt,len,next_fie ld)
    {

    if (event == "down")
    {

    phone_field_len gth=obj.value.l ength;

    }

    else if (event == "up") {

    if (obj.value.leng th != phone_field_len gth)
    {

    phone_field_len gth=obj.value.l ength;

    if (phone_field_le ngth == len)
    {

    var next=document.g etElementById(n ext_field);

    if(next != null)
    next.focus();

    }

    }

    }

    }


    Thanks
Working...