Skip to content

Commit e65e7bf

Browse files
committed
qml: Add validators to address and amount inputs to limit characters
1 parent aa927c5 commit e65e7bf

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/qml/controls/LabeledTextInput.qml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Item {
1313
property alias iconSource: icon.source
1414
property alias customIcon: iconContainer.data
1515
property alias enabled: input.enabled
16+
property alias validator: input.validator
1617

1718
signal iconClicked
1819
signal textEdited

src/qml/pages/wallet/Send.qml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ PageStack {
179179
placeholderText: qsTr("Enter address...")
180180
text: root.recipient.address
181181
onTextEdited: root.recipient.address = address.text
182+
validator: RegExpValidator {
183+
regExp: /^[1-9A-HJ-NP-Za-km-zac-hj-np-z02-9]+$/
184+
}
182185
}
183186

184187
RowLayout {
@@ -244,6 +247,10 @@ PageStack {
244247
root.recipient.amount.format()
245248
}
246249
}
250+
validator: RegExpValidator {
251+
regExp: /^(0|[1-9]\d*)(\.\d{0,8})?$/
252+
}
253+
maximumLength: 17
247254
}
248255
Item {
249256
width: unitLabel.width + flipIcon.width

0 commit comments

Comments
 (0)