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
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.
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!
Solved! Go to Solution.
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
Power Apps Portals Super User
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
Power Apps Portals Super User
Hi @OliverRodrigues, I did the solution you mentioned but I still have the same problem.
This is the content snippet I created
Apparently it was just capitalizing the first letter of "code".
Name: "Tracking Code"
Thank you very much.
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.