Infragistics Home

Infragistics Forums

Infragistics community online discussions.
Welcome to Infragistics Forums Sign in | FAQ
in Search

Switch between WebMaskEdit and WebTextEdit for Postal Codes during runtime

Last post 08-07-2008 17:16 by [Infragistics] Viktor Snezhko. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 07-26-2008 13:58

    • danid12
    • Top 500 Contributor
    • Joined on 07-26-2008
    • Points 245

    Switch between WebMaskEdit and WebTextEdit for Postal Codes during runtime

    I have a page that has employee info, such as their address.  I want the user to be able to enter in US zip + 4 using the WebMaskEdit (Zip Code), but they also need to be able to enter foreign postal codes, which need to have alpha characters, such as Canada (i.e. L7J 1K3).   The country dropdown will be blank if the address is US and something will be selected if it's a foreign address.  Is there a way to switch the mask from WebMaskEdit (Zip Codes) to WebTextEdit (allowing alpha-numeric) during runtime depending on whether the user has selected a country?

    • Post Points: 20
  • 08-07-2008 17:16 In reply to

    Re: Switch between WebMaskEdit and WebTextEdit for Postal Codes during runtime

    Hi,

    Changing control from mask to no-mask is not supported. Also changing mask on client is not supported neither (you will get problem on server with interpretation value).

    However, since WebTextEdit allows dynamic filtering it is quite simple to turn it into any filter. For example, process ClientSideEvents.KeyDown and implement it by something like below

    // that will allow to enter only digits by client
    function WebTextEdit1_KeyPress(oEdit, keyCode, oEvent)
    {
     
    if(!this._onlyDigits) return;
     
    if(keyCode < 48 || keyCode > 57)
      oEvent.cancel =
    true;
    }

    // assume that is your setter mask/noMask function
    function myDynamicMaskSet(enable)
    {
     
    var edit = igedit_getById('WebTextEdit1');
     
    if(!edit)
      {
        alert(
    'can not find WebTextEdit1');
       
    return;
     
    }
     
    if(enable)
      {
        edit.elem.maxlength = 5;
        edit._onlyDigits =
    true;
      }
     
    else
     {   
        edit.elem.maxlength = 8;

       
    edit._onlyDigits = false;
      }
    }

    Regards,
    Viktor
    Infragistics web team
    • Post Points: 5
Page 1 of 1 (2 items)
Powered by Community Server (Commercial Edition), by Telligent Systems