Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #550 from egovernments/PFM-4462
Browse files Browse the repository at this point in the history
PFM-4462
  • Loading branch information
rahuldevgarg authored Sep 8, 2023
2 parents 5bbe50c + e512299 commit 7baa86f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class _ExpenseDetailsState extends State<ExpenseDetails> {
textInputType: TextInputType.number,
inputFormatter: [
FilteringTextInputFormatter.allow(
RegExp("[0-9]"))
RegExp(r"^[1-9]\d{5}$"))
],
labelSuffix: '(₹)',
isDisabled: (expenseDetails.allowEdit ?? true)
Expand Down
3 changes: 2 additions & 1 deletion frontend/mgramseva/lib/utils/validators/validators.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:mgramseva/utils/constants/i18_key_constants.dart';
import 'package:mgramseva/utils/localization/application_localizations.dart';
import 'package:mgramseva/utils/global_variables.dart';
import 'dart:math' as math;

class Validators {
static validate(value, type) {
Expand Down Expand Up @@ -109,7 +110,7 @@ class Validators {
static String? amountValidator(String? v) {
if (v!.trim().isEmpty) {
return '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.expense.AMOUNT_MENTIONED_IN_THE_BILL)}';
} else if (double.parse(v) <= 0) {
} else if (double.parse(v) <= 0 || (((math.log(double.parse(v!)) / math.ln10) + 1) as int) > 6) {
return '${ApplicationLocalizations.of(navigatorKey.currentContext!).translate(i18.expense.ENTER_VALID_AMOUNT)}';
}
return null;
Expand Down

0 comments on commit 7baa86f

Please sign in to comment.