gluon-web-model: remove unused field error message code
Validation errors are mostly handled in the frontend (by displaying invalid fields with a red background). There was some code left in the backend for handling different kinds of errors, and returning custom error messages from validate(), but the resulting value was not used anywhere.
This commit is contained in:
parent
5adbaf2907
commit
45b518df11
@ -186,6 +186,7 @@ function AbstractValue:__init__(...)
|
||||
|
||||
self.template = "model/valuewrapper"
|
||||
|
||||
self.error = false
|
||||
self.state = M.FORM_NODATA
|
||||
end
|
||||
|
||||
@ -205,14 +206,9 @@ function AbstractValue:cfgvalue()
|
||||
end
|
||||
end
|
||||
|
||||
function AbstractValue:add_error(type, msg)
|
||||
self.error = msg or type
|
||||
self.state = M.FORM_INVALID
|
||||
end
|
||||
|
||||
function AbstractValue:reset()
|
||||
self.error = nil
|
||||
self.data = nil
|
||||
self.error = false
|
||||
self.state = M.FORM_NODATA
|
||||
|
||||
end
|
||||
@ -220,13 +216,9 @@ end
|
||||
function AbstractValue:parse(http)
|
||||
self.data = self:formvalue(http)
|
||||
|
||||
local ok, err = self:validate()
|
||||
if not ok then
|
||||
if type(self.data) ~= "string" or #self.data > 0 then
|
||||
self:add_error("invalid", err)
|
||||
else
|
||||
self:add_error("missing", err)
|
||||
end
|
||||
if not self:validate() then
|
||||
self.error = true
|
||||
self.state = M.FORM_INVALID
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user