properly handle empty text entry fields (including transformations)

This commit is contained in:
kepler155c@gmail.com
2019-11-13 14:24:54 -07:00
parent 7e520744a2
commit 64ec8c82d3
13 changed files with 64 additions and 51 deletions

View File

@@ -106,7 +106,7 @@ local passwordPage = UI.WizardPage {
}
local function makeAddress(text, isPrivateKey)
local privKey = text
local privKey = text or ''
if not isPrivateKey then
privKey = Krist.toKristWalletFormat(privKey)
end
@@ -116,7 +116,7 @@ end
function passwordPage.form:eventHandler(event)
if (event.type == 'text_change' and event.element.pass) or
(event.type == 'checkbox_change' and event.element.ispkey) then
self.passEntry.shadowText = self.pkeyCheck.value and 'Private key' or 'Password'
self.passEntry.shadowText = self.pkeyCheck.value and 'Private key' or 'Password'
self.preview.value = makeAddress(self.passEntry.value, self.pkeyCheck.value)
self:draw()
end

View File

@@ -25,7 +25,7 @@ local shopTab = UI.Tab {
formLabel = 'Price', formKey = 'price',
help = 'Per item cost',
required = true,
validate = 'numeric',
transform = 'number',
},
[3] = UI.TextEntry {
limit = 64,