Extend Input-Mask validation method

Posted by: guido.corazza on 8 May 2019, 1:23 pm EST

    • Post Options:
    • Link

    Posted 8 May 2019, 1:23 pm EST

    Hi,

    I´m currently extending the input-mask validation method with some regular expressions. Is there any way of extending the validation with some custom code? If so, should i add an event handler to the same event that wijmo uses internally?

    Thanks in advance.

    Guido

  • Posted 9 May 2019, 2:32 am EST

    Hi Guido,

    Yes, for this, you need to handle the keydown and keyup event for InputMask hostelement as following code snippet and do your custom validation.

    theMask.hostElement.addEventListener("keydown",function(e){
    // prevent default Settings
    e.preventDefault();
    // your code here
    },true);
    

    Regards,

    Manish Gupta

  • Posted 9 May 2019, 5:45 pm EST

    Hi Manish,

    Thanks for such a quick reply!

    What if i want Wijmo’s validation, and after that validation make some extra validation. Should i still need to handle the same events?

    Thanks in advance.

    Regards,

    Guido

  • Posted 10 May 2019, 5:43 am EST

    Hi Guido,

    You may check the add on validation using valueChanged event. Please refer to the following demo sample for reference:

    https://www.grapecity.com/wijmo/demos/Input/InputMask/Validation/purejs

    Further, if it is not suitable, you may use the keypress/keyup event same as following demo sample:

    https://jsfiddle.net/Wijmo5/j6er01bx/

    Hope it helps!

    If the issue persists or you have any further queries, please elaborate your use-case.

    Regards,

    Manish Gupta

  • Posted 30 May 2019, 9:44 am EST

    Thanks!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels