Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InputMask: optional part does now work correctly #6469

Closed
tuerker opened this issue Nov 2, 2020 · 9 comments · Fixed by #6471
Closed

InputMask: optional part does now work correctly #6469

tuerker opened this issue Nov 2, 2020 · 9 comments · Fixed by #6471
Assignees
Labels
🐞 defect Bug...Something isn't working
Milestone

Comments

@tuerker
Copy link
Contributor

tuerker commented Nov 2, 2020

@melloware with the change from the april to latest snapshot, p:inputMask is not working anymore correctly at least for mask with optional cases.

example:

        <p:inputMask
          value="#{user.phoneNumber.areaCode}"
          mask="9[999]"
          size="4" />

previously it was working well as follows:

        <p:inputMask
          value="#{user.phoneNumber.areaCode}"
          mask="9?999"
          size="4" />

can you please check and fix this.

when i try to save, it clears the inputMask fields (see screenshot)

Screenshot from 2020-11-02 13-33-45

@tuerker tuerker added the 🐞 defect Bug...Something isn't working label Nov 2, 2020
@tandraschko
Copy link
Member

tandraschko commented Nov 2, 2020

Please always check the migration guide before you create a ticket ;) https://primefaces.github.io/primefaces/9_0/#/../migrationguide/9_0

sorry, only checked the last example :D

@melloware
Copy link
Member

I will look into this but we moved to a new component as the previous InputMask had so many bugs including problems with ? as the optional character.

@melloware
Copy link
Member

melloware commented Nov 2, 2020

To fix it right now add validateMask="false" which turns off the server side validation which is where its failing. I have to look at how the server side regex is being translated and fix it.

@melloware melloware self-assigned this Nov 2, 2020
@melloware melloware added this to the 9.0 milestone Nov 2, 2020
@tuerker
Copy link
Contributor Author

tuerker commented Nov 2, 2020

validate="false" does not solve it. if i enter 44 for the areacode this is translated to 44__ such that the folloowing error is thrown:

'44__' must be a number between -2147483648 and 2147483647 Example: 9346

@tuerker
Copy link
Contributor Author

tuerker commented Nov 2, 2020

this is because error is of course due to the fact that areaCode should be an integer here!

@tuerker
Copy link
Contributor Author

tuerker commented Nov 2, 2020

using

slotChar=""

is a partial workaround which works in our case because we do not have case where two or more digits are required at least.

this should give you also a hint for the bugfix.

@tuerker
Copy link
Contributor Author

tuerker commented Nov 2, 2020

you have to clear the slotChars before doing the validation

@melloware
Copy link
Member

I have a fix. working on it now and writing and integration test.

melloware added a commit to melloware/primefaces that referenced this issue Nov 2, 2020
@melloware melloware linked a pull request Nov 2, 2020 that will close this issue
@melloware
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 defect Bug...Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants