Hi Guys,
I can't share the OML because I'm from the company, so I'll try to explain.
I have a field with input Number, but the variable of that field in the table is of type Long Integer. I need to check if the user is typing numbers from 1 to 9 for example:
Allow: 123456789 or empty field " "
disallow: 123 or 1 or 0
I'm using an if where I use a Length (input variable) >=1.
but I'm having a problem, if the user just types "0" it accepts.
Hi Fabiano,
I would suggest using a Mask and make use of RegEx (Regular Expression) patterns.
I would use the Input Mask Reactive forge asset, and would use the InputPatternMask:
I would use the pattern (^(?!0$))(^(?!1$))(^(?!123$))((\d)+| )
This pattern basically says that it does not allow a 0, nor a 1, nor a 123 and accepts any number of digits or a space.
Kind Regards,João
In this case, I can let the user enter any sequence, including starting with "0", my only restriction is that if the user enters a number in the field, this sequence must have size 9. I used the expression ^[0-9]{9 }, but it is not accepting if the sequence starts with "0"
I am getting confused with your requirements for the field.
From what I understand, your field should contain either 9 digits or left empty, right?
In that case, your pattern should be ((\d){9}|^$)
A brief explanation on the patterns:
Cheers,joão
Examples of strings that can be
typed:012346542
687593842" "
cannot accept:
0
235
23475098 = eight digits
"^[0-9]{9}|^$"
Hello
As you have mentioned you are using the If condition where the condition is: Length (input variable) >=1this condition itself says the length of the value entered in input must be greater than one or equal to one
So if you type any number 0 - 9, anything even trailing spaced if you not using the trim() function,
so if I type 0 = length = 100 = length = 2000 = length = 3123 = length = 3It is accepting this because it is validating it as true
What's wrong here?Or you are trying to achieve something else?If you want to enter a number you can, you can create a pattern using regular exp that will help you validate it.for numbers you can check : You can create your own or you will some on forums
Thanks
Sorry, I thought I put the entire condition, the check is
(Length(Input variable) >=1 and Length(Input variable <9) or
Length(Input variable) >=1 and Length(Input variable >9)
You can use Regex expressions of course and validate your form and fields if the values are valid or not or even also use forge components (assets)
But why do you instead of of validating after inserting values, prevent from the users input those forbidden values?
check this article about using JS to allow or not the user inserting numbers.
How to create simple validations for your screen text inputs :
https://medium.com/kinetit/how-to-create-simple-validations-for-your-screen-text-inputs-11954031513a
I did not try this on a reactive app but in a web traditional but i guess is about the samme.
Regards,
Unfortunately, here in the project the company does not allow the use of JS