Currently building a backend administrators control panel for an iOS app I've developed. From this control panel an admin can add items to a store. One of the properties/attributes of a item would be it's price.
I'd like the price in this format only:
Min price: £0.00 and Max price: £000.00
I figured I could create two select dropdown fields then just combine the values before submitted my form.
However I'm wondering if there is a regex I can create that I could include in my form validation. My current price field is a standard text field and right now an admin can enter things like 000.444 4304.34 32.345 and get away with it. The minimum price for items in the store would be 0.00 and the maximum would be 300.00.
Is it possible to create a regex that allow numbers to be entered in this format only? Stopping things like 34.3455, 43.454, 34,54, 3,444, 434334..34 being submitted to the database?
I could do some validation with javascript in the cloud (I use parse.com as a backend database for the ios app and rails is linked up with it) to do some validation but I'd prefer to do client side and server side validation. Don't want the form being submitted unless it's 100% correct.
Would appreciated some advice
Thanks for your time