RadMaskedTextBox: Set Max Using Javascript

4 posts, 0 answers
  1. Mahesh
    Mahesh avatar
    6 posts
    Member since:
    May 2009

    Posted 08 May 2009 Link to this post

    Hello,
    I am trying to set the mask using java script but i am not able to do it

    Here is my code

    case "4###############":
                masks = [
                            new Telerik.Web.UI.RadLiteralMaskPart('4'),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart()
                         ];
                text._length = 0;
                text._setMask(masks);
                text.set_value('');
                 break;
             case "<51..55>#############":
                 masks = [
                            new Telerik.Web.UI.RadNumericRangeMaskPart(51, 55, false, true),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart()
                          ];
                 text._length = 0;
                 text._setMask(masks);
                 text.set_value('');
                break;
            case "<34|37>#############":
                var Values = new Array(34,37);
                masks = [
                            new Telerik.Web.UI.RadEnumerationMaskPart(Values),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart()
                          ];
                text._length = 0;
                text._setMask(masks);
                text.set_value('');
                break;
            case "<3|1800|2131>##############":
                masks = [
                            new Telerik.Web.UI.RadLiteralMaskPart('<3|1800|2131>'),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart()
                          ];
                text._length = 0;
                text._setMask(masks);
                text.set_value('');
                break;
            case "<300|301|302|303|304|305|36|38>############":
                break;
            case "6011############":
                    masks = [
                            new Telerik.Web.UI.RadLiteralMaskPart('6011'),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart(),
                            new Telerik.Web.UI.RadDigitMaskPart()
                         ];
                    text._length = 0;
                    text._setMask(masks);
                    text.set_value('');
                    break;
                    default:
                        text._length = 0;
                        text.set_value('');
                    break;


    Am not able to create mask for <34|37>############# and not able to input values in text box

    Thanks & regards
    Mahesh
  2. Sebastian
    Admin
    Sebastian avatar
    9934 posts

    Posted 11 May 2009 Link to this post

    Hello Mahesh,

    Defining a mask for our RadMaskedTextBox control is possible only server-side. I hope that using the server approach is feasible workaround for you (_setMask method is for internal usage only).

    Kind regards,

    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Mahesh
    Mahesh avatar
    6 posts
    Member since:
    May 2009

    Posted 11 May 2009 Link to this post

    Thanks for your replay
    I am very much agree that _setMask method is for internal usage only but it is possiable to use it.
    I am not using any update panal on my pages the, the arch. of my application is purliy SOA based so partial upate is not possiable

    Now I am able to set the mask for  this type '4###############', '<51..55>#############' using new Telerik.Web.UI.RadLiteralMaskPart('4') and  new Telerik.Web.UI.RadNumericRangeMaskPart(51, 55, false,true)

    but not able to for  '<34|37>#############' this kind, not sure but    new Telerik.Web.UI.RadEnumerationMaskPart(),

    is not working for me not sure where i am going wrong or is there any other way i can use.

    Thanks again for all your efforts.

    Thanks & regards
    Mahesh

  4. Mahesh
    Mahesh avatar
    6 posts
    Member since:
    May 2009

    Posted 09 Jun 2009 Link to this post

    Ok I found the problem

    new Telerik.Web.UI.RadEnumerationMaskPart(Values), works fins just went wrong initializing the array.

    here is new code : var Values = new Array("34","37"); 

    Old Code : var Values = new Array(34,37);



Back to Top