inputMask: doesn't work if created programmatically
See original GitHub issueDescribe the bug
I have an application that’s built on primefaces 12 to generate dynamic pages based on backend database, and I create InputMask as follows :
Application application = FacesContext.getCurrentInstance().getApplication();
InputMask inputNumber = (InputMask) application.createComponent(InputMask.COMPONENT_TYPE);
inputNumber.setMask("999999999999999");
inputNumber.setSlotChar("");
inputNumber.setAutoClear(false);
inputNumber.setValidateMask(false);
inputNumber.setId(property.getSymbolicName());
inputNumber.setMaxlength(15);
myPanelGrid().getChildren().add(inputNumber);
Issue : the mask doesn’t work in my xhtml page and I get error in console :
Widget class ‘InputMask’ not found!
So I tried manually to import the inputMask script as follows :
<h:outputScript library="primefaces" name="inputmask/inputmask.js" target="head" />
<h:outputScript library="primefaces" name="validation/validation.js" target="head" />
But it didn’t work also The only working workaround was to manually add in page a hidden inputMask component as follows :
<p:inputMask style="display:none"/>
Question : How to make the inputMask works fine without this workaround ?
Reproducer
No response
Expected behavior
No response
PrimeFaces edition
Community
PrimeFaces version
12.0.0
Theme
No response
JSF implementation
Mojarra
JSF version
2.3.9
Java version
1.8
Browser(s)
No response
Issue Analytics
- State:
- Created a year ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Primefaces InputMask doesn't work if created programmatically
I have an application that's built on primefaces 12 to generate dynamic pages based on backend database, and I create InputMask as follows...
Read more >Masking does not work with form elements created with jQuery
Hi, I am adding a row to an input table using the following jQuery code. Unfortunately, the masking does not work for the...
Read more >Using input masks in React Native - LogRocket Blog
Implement input masks in React Native to develop user-friendly input constraints such as entering data according to a pre-defined format.
Read more >Input Mask | WinForms Controls - DevExpress Documentation
Input masks restrict data input and allow you to guide users to enter correct values. For instance, you can apply the phone number ......
Read more >How to Use an Input Mask in Microsoft Access ... - YouTube
In this video, I will teach you how to use an Input Mask in your Microsoft Access tables and forms. We will create...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nevermind I see it now:
If you’re open to an alternative, you might be also interested in this: https://www.primefaces.org/showcase-ext/sections/dynaform/basicUsage.jsf