web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Add field mask – Power...
Power Pages
Answered

Add field mask – PowerApps

(0) ShareShare
ReportReport
Posted on by 312

I am working with forms in PowerApps portals, do the procedure of how to add masks to a field within an entity form in the following blog by @OliverRodrigues . And it worked pretty well.

 

http://oliverrodrigues365.com/2020/04/15/power-apps-portals-adding-field-mask

 

MartinVargas_0-1652400981637.png

 

However, implement a list for the creation of a new record with the above form. But apparently it is not taking the programming of the code in this part.

 

MartinVargas_1-1652401010612.png

 

This is the form code:

$(document).ready(function(){
 

 //DECIMAL NUMBER

 let fieldName = "crb57_decimalnumber";
 //hide initial field
 $("#" + fieldName).hide();
 //create new masked input
 let maskedInput = document.createElement("input");
 maskedInput.className = "form-control";
 maskedInput.id = "maskedInput";
 //add function to set correct value
 maskedInput.oninput = () => {
 let newValue = parseFloat($("#maskedInput").val().replace(/\D/g, ''), 10)/100;
 console.log(newValue);
 $("#" + fieldName).val(newValue);
 }
 //apply mask
 $(maskedInput).mask("###,##0.00", {reverse: true});
 //insert maskedInput after initial one
 $(maskedInput).insertAfter($("#" + fieldName));

 // WHOLE NUMBER

 let fieldName1 = "crb57_wholenumber";
 //hide initial field
 $("#" + fieldName1).hide();
 //create new masked input
 let maskedInput1 = document.createElement("input");
 maskedInput1.className = "form-control";
 maskedInput1.id = "maskedInput1";
 //add function to set correct value
 maskedInput1.oninput = () => {
 let newValue1 = parseInt($("#maskedInput1").val().replace(/\D/g, ''), 10);
 $("#" + fieldName1).val(newValue1);
 }
 //apply mask
 $(maskedInput1).mask("#,##0", {reverse: true});
 //insert maskedInput after initial one
 $(maskedInput1).insertAfter($("#" + fieldName1));

 // TEXT

 $("#crb57_text").mask("#,##0.00", {reverse: true});

 
});

 

From my perspective you need to reference the JS. But I don't know this part.

 

$(document).ready(function(){
 
	src="/jquery.mask.min.js";

 ...
});

 

Could someone help me here?

 

Thanks in advance!

Categories:
I have the same question (0)
  • Verified answer
    oliver.rodrigues Profile Picture
    9,482 Most Valuable Professional on at

    hi @MartinVargas the JS reference you can do in multiple places, in my article I am giving the example as being the Web Page, you can also add the reference in a generic Content Snippet called Tracking Code

    simply create (or update) the content snippet and add the reference, this will make the mask js library be loaded on every page

     

    hope this makes sense

  • MartinVargas Profile Picture
    312 on at

    Hi @OliverRodrigues, I did the solution you mentioned but I still have the same problem.

     

    This is the content snippet I created

    MartinVargas_0-1652454788855.png

     

  • MartinVargas Profile Picture
    312 on at

    Apparently it was just capitalizing the first letter of "code".

     

    Name: "Tracking Code"

     

    Thank you very much.

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Pages

#1
11manish Profile Picture

11manish 42

#2
omkarsupreme Profile Picture

omkarsupreme 37

#3
Valantis Profile Picture

Valantis 35

Last 30 days Overall leaderboard