Skip to main content

Notifications

Community site session details

Community site session details

Session Id : xlafFWRfAX2Rvy/8HrXFOy
Power Apps - Building Power Apps
Answered

Input Mask Custom Control on Model Driven App

Like (0) ShareShare
ReportReport
Posted on 10 Oct 2020 19:55:15 by 76

This is my first time trying to use a custom control on a model driven app and I'd appreciate some help

 

I'm trying to use the Input mask custom control on a main form OnChange event to validate data entry into a field so that only the number format 0,0,0,0,0, ,0,0,0,0,0 is allowed (e.g. 12345 12345)

 

However when I try to enter data into the field I keep getting an error:

 

Web resource method does not exist: OnChange

Session Id: (Removed)

Correlation Id: (Removed)

Event Name: onchange

Web Resource Name: cc_MscrmControlsDOTInputMaskDOTInputMaskControlFORWARDSLASHInputMaskControlDOTjs

Solution Name: CustomControlsCore

Publisher Name: microsoftdynamics

Time: Sat Oct 10 2020 16:55:57 GMT+0100 (British Summer Time)

 

I think the problem is I don't really know what I should be setting the "Function" field to in the Configure Event window, so I've just tried to use a few different things I've found online but they all give the same error

 

I haven't been able to find any documentation on this custom control (InputMaskControl.js) otherwise I'd be able to make better sense of it

 

Here's how I've got the field and event configured at the moment

 

CustomControlError1.pngCustomControlError2.png

 

Thanks for reading

  • JohnEmad Profile Picture
    7 on 08 Jun 2022 at 14:33:36
    Re: Input Mask Custom Control on Model Driven App

    Thanks for your solution.

    To further enhance it I have 2 questions.

    1. Could you provide any help of achieving a certain pattern ?
      like for example:
      if there is an input mask like this to be all numbers 
      (---)--------
      (000)00000000
      What if I want (000) to have a pattern  = 010,011,012,015 always ( with these certain numbers ) ?

      The goal eventually is to have a pattern that validates Egyptian Mobile Numbers
      Original Regex: ^[\u0660][\u0661][\u0660-\u0662,\u0665]{1}[\u0660-\u0669]{8}|01[0-2,5]{1}[0-9]{8}$
      (Including arabic number unicodes)
      OR to simplify: 
      ^01[0125][0-9]{8}$
      as in https://regex101.com/library/fD36KR 


    2. Can we apply an input mask to a phone number? because I always get an error when I try to do this.
  • tschopp Profile Picture
    306 on 28 Oct 2020 at 18:18:59
    Re: Input Mask Custom Control on Model Driven App

    I tried using the Input Mask control and it works great on the form.  I'm using it for formatting phone numbers.  But the data is not saved with the mask, only the numbers are saved with no formatting.  On the subgrid, the data is displayed without the formatting.  Is there a way to get it formatted on the grid as well?

  • timl Profile Picture
    34,978 Super User 2025 Season 1 on 12 Oct 2020 at 10:39:53
    Re: Input Mask Custom Control on Model Driven App

    You're welcome @Spikyface - I'm glad that helped you!

  • AU-22040756-0 Profile Picture
    76 on 12 Oct 2020 at 10:27:10
    Re: Input Mask Custom Control on Model Driven App

    @timl thanks so much for your clear and concise answer, I've implemented the input mask in the right way now and it works perfectly!

  • Verified answer
    timl Profile Picture
    34,978 Super User 2025 Season 1 on 11 Oct 2020 at 10:25:19
    Re: Input Mask Custom Control on Model Driven App

    Hi @Spikyface 

    The input mask control creates a masked input field where the user can only enter data that matches the format that you specify. Therefore, there's no need to trigger the application of the mask through any event such as OnChange.

    In the form designer, you would switch to classic view and you would add your field to the form. You would click the change properties button to bring up the field properties dialog. In the controls tab, you would add the input mask control. You should make sure to check the 'web' radio button against this control once you add it.

    In the mask setting, you would enter "00000 00000". This would correspond to the format 12345 12345.

     

    timl_0-1602411682431.png

     

     

    Here are the acceptable mask characters.

    0 – Digit
    9 – Digit or space
    # – Digit, sign, or space
    L – Letter
    I – Letter or space
    A – Alphanumeric
    A – Alphanumeric or space
    < – Converts characters that follow to lower case
    > – Converts characters that follow to upper case
    | – Disables case conversion
    \ – Escapes any character, turning it into a literal

     

    Here's how the control looks at runtime. As you can see, there are lines that correspond to the mask. The control rejects the keyboard entry of anything other than a number.

    timl_1-1602411774887.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,745 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,091 Most Valuable Professional

Leaderboard
Loading started
Loading complete