Reputation: 12685
I have Firebase data structure like this:
As you can see in the image, the value of OT1
, OT1_B
, etc. is Integer. Now, I want such a validation that no one can save value of other data-type for this key.
How can set I rule for this kind of restriction?
Upvotes: 2
Views: 1148
Reputation: 1809
If you are taking user input for that fields then simply adding ,
android:inputType="numberDecimal"
will do a work for you
Upvotes: 0
Reputation: 2700
There is a rule available to validate your data in FireBase RealTime Database. Use .validate
rule to check if your data is a string or other type and you can also use regular expression to check the matches.
Refer the official documentation to check how to Validate Data under section
Validating Data.
Upvotes: 2