Min / Max validation for number/decimal input

  • 22 October 2019
  • 4 replies
  • 122 views

Badge +4

I need to validate a decimal input. I'm wondering how I can use view validation to require and ensure the value is > 12. How do I do this? This seems like an basic, foundational capability, but I don't see how to do it. I can write a rule or expression, but that seems combersome for such a thing.

 

Does anyone have any suggestions?


4 replies

Badge +9

Hi Bmorgan


 


See the solution below:


Step1:


Design a textbox and a button on item view



Step2:


Click the button to be highlighted and go to rules



 


Step3:


By clicking an advanced condition the following will appear



 


 


Step4:


Click Configure rule on show message to the user



 


Step 5:


Run the program and enter a number less than 20 e.g 10



 


Additionally, if you would like this validation to prevent the form from submitting until number greater than 20 is entered, you can add a "Stop rule execution rule" under the advanced condition.


 


I hope this will help you!!!


 


Regards


Elvis


 


 

Badge +9

Hi bmorgan,


 


The best way would probably be to use Regex expressions. On an input box there is an option for "Pattern", the tricky part (if you are unfirmiliar with Regex) would be to find a Regex Pattern that suits your needs.


This site might help: http://www.regexlib.com


 


For a quick test it seems that this pattern might help:


/[2-9][0-9]|1[2-9]|11[0-9]/g


 


-Jean


 

Badge +4

Thank you. This may be the only/best route, I was just hoping for a way that wouldn't result in a rule soup on my view. It's going to be a lot of effort (considering all the fields that this will affect on this view) for something that's so simple.

Badge +9

Hi Bmorgan 


 


I think another way of doing this is by using regex , see the screenshot below:


Step1: Desing a textbox



Step2: Click on textbox to be highlighted>click pattern on the righthand side>Add Pattern.



 


Step3:



Number more than 12 it does not show error message e.g.



 


 


Regards


Elvis

Reply